The first step with SkImage will be to load and save images. That's what we'll see in this section.
Loading or creating an image
In order to get an image, you can:
- load an image from a file (such as a
- create an image from scratch (with a specific size and type)
You can specify the type of the image as an int (by adding
with type X at the end). The specified type will be used to create the encoding of the image:
TYPE_INT_RGB(such as a
jpgimage, no transparency)
TYPE_INT_ARGB(such as a
pngimage, with transparency)
TYPE_INT_ARGB_PRE(such as a
pngimage, with transparency and pre-multiplied alpha)
And more are available at the JavaDoc.
Saving an image
The only way to save an image is to use the
save effect. It will save the image in the specified file path.
- If the desired file path doesn't exist, it will be created.
- If the file already exists, it will be overwritten.