How can I add an image generator to use webp format files?

Hi.
I want to add webp format files for animation display, but I encountered some problems when adding image generator. I created a sandbox application project and added the dependency of ImageGenerator. There was a problem when adding services. When I created a file under the META-INF/service/path, what format should I record the created class and package name? And how should I rebuild the image generator extension? I haven’t seen anything related to the image generator extension.
Thank you for your reply.

Hello

Do you want to add the WEBP extension or do you want to add a new custom extension?

Hope that helps.
Best,

Hi
I have added the WEBP extension in the Developer Repository. When calling through the Api of ImageIO. read(), there was a problem that such an image could not be decoded because there was no runtime decoder capable of decoding this image. How to use ImageIO to call resources in WEBP format?
Thank you for your reply.

Hi,

On the Simulator, just need to add the dependency <dependency org="com.microej.tool" name="imageio-webp" rev="1.0.2"/>. After the VEE Port build, you can retrieve this jar in tools folder:

Note that this jar is also used by the Image Generator. Thanks to it, the ImageGenerator is now able to decode WEBP file and to encode them in a RAW format

/pathto/myimage.webp:RGB565

For the embedded side, as explained here Image Loader — MicroEJ Documentation, you have to implement the function LLUI_DISPLAY_IMPL_decodeImage in your BSP. This function is called by the framework to decode the images (JPG, WEBP, etc.). In your case, you have only the WEBP decoder so you can implement the function like this:

LLUI_DISPLAY_Status LLUI_DISPLAY_IMPL_decodeImage(uint8_t* addr, uint32_t length, jbyte expectedFormat, MICROUI_Image* data, bool* isFullyOpaque) {
	return MICROEJ_DECODE_webp(addr, length, (MICROUI_ImageFormat)expectedFormat, data, isFullyOpaque);
}

Best Regards,
Guillaume