Images
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
png
orjpg
file) - create an image from scratch (with a specific size and type)
Info
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:
0
forTYPE_INT_RGB
(such as ajpg
image, no transparency)1
forTYPE_INT_ARGB
(such as apng
image, with transparency)2
forTYPE_INT_ARGB_PRE
(such as apng
image, 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.
Info
- If the desired file path doesn't exist, it will be created.
- If the file already exists, it will be overwritten.