How to scale a bmp image?

Hi,
Now i want to scale a bmp image with littlevgl , do you have any suggest for me?Thanks.

1 Like

I also want to know if there is a dynamic way to change the size of the picture.

You might be able to use the lv_canvas object with lv_canvas_rotate(img, canvas_obj, 0, 0, 0, 0). That could scale the image without rotating.

How do you mean it? rotate just rotates not scales.

Well, maybe I’m missing something, but it looks like it is prepared for differing widths and heights. In addition, upscaling is mentioned:

@embeddedt
Sorry, it seems I forget to answer it.

Upscale in this context means to virtually upscale the image to deal with 256x256 subpixels / pixel. When getting the source pixel related to a destination pixel the “upscaled” image with subpixels is rotated. The rotation tells which subpixel of the source image corresponds to the destination pixels. It gives the opportunity for interpolation. E.g. if the very edge of the source pixel needs to be used in the destination pixel then its color is mixed with the neighbor pixel.

@kisvegabor Thanks! I learned something new today. :slight_smile:

For any future readers, the current situation (as of v6.0) is that you can’t scale a picture. This might have changed in a future version, however.

dev-7.0 has added an experimental lv_img_set_zoom function.

1 Like

@kisvegabor @embeddedt how to scale image just in one direction?

Only proportional scaling is supported at the moment. You can’t scale the image in one direction.