Flip the display UI/Image using LVGL

I am testing with IMXRT1064 EVK board for validation. Using GUI guider for implementing UI in IMXRT1064 board.

But I need to do Vertical Flip for an image or display using LVGL.

Can you please suggest any API or functional logic to do Vertical Flip on display.


Do you need to flip only an image or the whole rendered screen?

Hi Kisvegabor,

I need to flip whole rendered screen using LVGL.


Any idea regarding above query?

Almost all display controllers have an option to set all the existing symmetries.
See here.
This function can only set 4, but you can play with the values to get the ‘flip’ you want.
Hope this is helpful.

1 Like

LVGL also supports software rotation. See here: Display interface — LVGL documentation

1 Like

Hi all,

Thanks for your reply.
You have suggested display orientation and rotation, but I need display flip like vertical and horizontal flip (like mirror image) feature in LVGL.
Please suggest those things.

As I said in my previous response most display controller ICs have all the rotations/flips available. You need to look at the controller datasheet. Here is an example for the ILI9486 controller:

static void ili9486_set_orientation(uint8_t orientation, bool ver_flip)
	// ESP_ASSERT(orientation < 4);

	const char *orientation_str[] = {

	ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]);

	uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
	uint8_t data_inv[] = {0x08, 0xC8, 0xA8, 0x68};

	ESP_LOGI(TAG, "0x36 command value: 0x%02X", data[orientation]);

	ili9486_send_data((void *)(ver_flip ? &data_inv[orientation] : &data[orientation]), 1);

Here data_inv contains the register values that include vertical flip. Figuring the values out using just the datasheet is not that easy, but there are only few combinations, so it’s easy to check all of them.

Usually the LCD periphery of the MCUs (that drive the LCD directly) do not support rotation and flipping.

Got it. @embeddedt how complicated would it be to support software horizontal and vertical flip besides rotation?

It should be a lot simpler than rotation, since I believe all the flip combinations can be done by iterating over the buffer and swapping values instead of needing a secondary buffer.

However, can’t it be implemented simply by reversing the loops in the user’s flush_cb function? Even a flip transformation within LVGL incurs a performance cost, as that is essentially how I implemented 180-degree rotation. Off the top of my head, I recall a 15-30% performance hit when STM32 was configured to rotate 180 degrees instead of 0.

Unfortunately, it can’t work if the image is sent by DMA in one block. It might work in this particular case though. (area also needs to be mirrored, y=0…10 should be e.g. y=261…271)


Actually NXP pxp for RT1064 has flip and rotation example, Can you help us to integrate these functionalities into lvgl hal_disp layer. This will be more helpful for us or please help guide us to integrate , if we finished we will commit the code into lvgl.


We are also planning to do some lens distortion correction, if you guys have any idea , please share your views that will be grateful for us.