Needle gauge draw

How to draw this needle gauge without the white area?

Is the image color format Alpha byte?

Yes, I used lvgl image converter with “raw with alpha”

Please send the original image before conversion. It’s possible that it doesn’t have a transparent background to begin with.


I downloaded here:

OBS: I resized the image with paint

That is likely the issue. MS Paint does not work that well with transparent images. In this case it has put a white background on it. I would suggest using a better tool like GIMP.

The original image from ClipartMax appears to be properly transparent.


Thanks for the tip!! I installed Gimp, very cool.

But It’s not show my needle image. Here is the code that I’m using:

void create_needle()
	//Write codes screen_img_2
	screen_img_2 = lv_img_create(lv_scr_act(), NULL);

	//Write style LV_IMG_PART_MAIN for screen_img_2
	//static lv_style_t style_screen_img_2_main;

	//Write style state: LV_STATE_DEFAULT for style_screen_img_2_main
	lv_style_set_image_recolor(&style_screen_img_2_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_image_recolor_opa(&style_screen_img_2_main, LV_STATE_DEFAULT, 0);
	lv_style_set_image_opa(&style_screen_img_2_main, LV_STATE_DEFAULT, 255);
	lv_obj_add_style(screen_img_2, LV_IMG_PART_MAIN, &style_screen_img_2_main);
	lv_obj_set_pos(screen_img_2, 200, 200);
	lv_obj_set_size(screen_img_2, ponteiro.header.w, ponteiro.header.h);
	lv_obj_set_click(screen_img_2, true);
	lv_img_set_pivot(screen_img_2, 0,0);
	lv_img_set_angle(screen_img_2, 0);

Is it the same code you used with MS Paint?

Can you send the image from GIMP as well?

Yes, is the same code.

ponteiro.h (61.1 KB)

I’m not 100% sure, but this looks like it might be one of the PNG formats that the official converter struggles with. Can you try the image from GIMP with my converter instead? The user interface should be the same for the most part.

I’m getting error 404 when I click on link.

Meanwhile, we have moved that converter to the lvgl organization:

1 Like

I’m not getting success.
Image converter give me header.h and header.w without size when I select RAW with Alpha.
Should I need change this manually?

const lv_img_dsc_t ponteiro = {
.header.always_zero = 0,
.header.w = 0,
.header.h = 0,
.data_size = 10030, = LV_IMG_CF_RAW_ALPHA,
.data = ponteiro_map,