语言

Menu
Sites
Language
How to save image object to an image file?

Hi, all.

My simple app needs to save image object to an image file.

I tried to do with 'evas_object_image_save' function, however the fuction's result is always 'FALSE'.

My code is as follows

Evas *evas = evas_object_evas_get(win);
Evas_Object *image = evas_object_image_filled_add(evas);
elm_image_memfile_set(image, bitmap, size, "bmp", NULL);
evas_object_image_save(image, save_path, NULL, "quality=100 compress=8");

I'd appreciate any help or advice.

Thank you!

响应

4 回复
colin Rao

Hi,

I've ever encountor similiar issue, I've try to create a image via cairo and save to device. My issue is related to the filapath, suggest you to try to write into a trusted path, for example, app_get_shared_trusted_path()?

KJ Lee

Hi,

Thank you for your answer.

My issue does not seem to be related to filepath.

I'm sure that the filepath is trusted and when I create a text file and write to that, any problem is not occurred.

Thank you.

colin Rao

yes, I already have a testing on my local environment, both emulator and Samsung Z1. 

Failed, maybe it's a bug of Tizen.

    Evas *e = evas_object_evas_get(ad->win);
    Evas_Object *img = evas_object_image_filled_add(e);
    evas_object_image_file_set(img, "/opt/usr/apps/org.tizen.test/res/images/logo.png", NULL);
    evas_object_resize(img, 200, 200);
    evas_object_show(img);
    char filename[PATH_MAX];
    snprintf(filename, sizeof(filename), "%s%s", app_get_shared_trusted_path(), "logo2.png");
    evas_object_image_save(img, filename, NULL, "quality=100 compress=8");
    dlog_print(DLOG_INFO, LOG_TAG, "%s\n", filename);
    evas_object_show(ad->win);

 

KJ Lee

Thank you for your answer.

I need to find another way.

Thank you!