How to enlarge the picture according to its length and width

Description

In my project, I need to enlarge the jpg image according to the length and width of the image. Not to scale up.

What MCU/Processor/Board and compiler are you using?

Linux gcc

What LVGL version are you using?

V7.4

What do you want to achieve?

Realize the picture display is enlarged according to the length and width.

What have you tried so far?

I tried to imitate the interface of lv_img_set_zoom and wrote the interfaces of lv_img_set_zoom_x and lv_img_set_zoom_y respectively. However, when using it, it is still enlarged according to the same scale, and there is a ghost. (A picture that does not completely overlap is displayed on the interface twice). Can you provide some guidance? Looking forward to your reply, thank you very much.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Do you mean height and width? So set a width/height and the image should be zoomed to fit the set size?

Anyway, jpeg images can’t be zoomed directly because they are decompressed in a special way to save memory. And one limitation of this decompression method is transformations (zoom, rotate) can’t be performed.

Yes, I mean to set the picture display size by width and height. Regarding the decoding problem you mentioned, can I understand it here? Replace the JPEG decoding method with one that can obtain all the decoded data of JPEG or replace the decoding library that supports JPEG files to be read into the memory at one time. JPEG files can support scaling.

1 Like

I’ve opened a future request about adding an option to decode the whole image:

Thank you very much, and look forward to an early resolution.

1 Like