Language
Deserialization
PhotoEditor SDK supports serialization and deserialization, allowing your users to save and revise their work at any time. Deserialization requires the backend:serializer
module. Refer to our documentation on how to include the module in your project.
Restoring a settings file#
For the sake of this example, we load a photo from the resources into the photo editor.
To restore an editor instance to a previous state, we read the serialization from a JSON file using the IMGLYFileReader.readJson()
method. Since reading a file is an IO Operation, we do this inside of a coroutine on the IO Dispatcher.
The IMGLYFileReader.readJson()
method is overloaded to also accept a String
or a ByteArray
to read into a SettingsList
.