APIs missing: exporting Images
Exporting images at the moment is pretty complex.

1. We don't have the original Image name
Images are stored only with an ID: it would be nice to have also their original name
<img width="590" alt="CleanShot 2022-06-23 at 15 29 59" src="https://user-images.githubusercontent.com/72731885/175324075-cfb4b613-0b51-4d42-91c9-591e25a5004e.png">

2. We don't have an easy way to read them
a. To read an image from a pattern fill:
`let patternImage = fill._object.image().treeAsDictionary().sha1;`
b. To find the ID of an image from an image layer:
`let patternImageID = fill._object.image().treeAsDictionary().sha1;`
it is easier if it is an image layer or an override of an image layer
```
let imageID = layer.image.id
```

```
let imageID
if (override.property == "image") {
    imageID = String(override.value.id)
}
```

3. We don't have an easy way to export them
To export an image is more complex, as the stored image values are a native NSImage object.
I found a few ways to do it, the easiest one is the one coming from Automate (and export them as PNGs or JPEGs based on the function of choice:

```
let imageData = layer.image; [or layer.fills[0].pattern.image]
let path = [path of a folder of choice]

function exportImageDataAsPng(imageData, path) {
    var rep = NSBitmapImageRep.imageRepWithData(imageData.nsdata);
    var png = rep.representationUsingType_properties(
        NSBitmapImageFileTypePNG,
        {}
    );
    png.writeToFile_atomically(path, "YES");
}

function exportImageDataAsJpg(imageData, path, quality) {
    var rep = NSBitmapImageRep.imageRepWithData(imageData.nsdata);
    var jpg = rep.representationUsingType_properties(
        NSBitmapImageFileTypeJPEG,
        { NSImageCompressionFactor: quality || 0.75 }
    );
    jpg.writeToFile_atomically(path, "YES");
}
```


It would be nice to be able to export images with their original name (I understand it will not possible to export them with the original filetype):

`let imageToExport = layer.image.export(path);`
or
`let imageToExport = layer.fills[0].pattern.export(path);`
