Page MenuHomePhabricator

File Metadata

Author
netstar
Created
May 16 2017, 7:51 AM
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_File.h>
#include <Ecore_Evas.h>
#include <Evas.h>
#include <Emotion.h>
int main(int argc, char **argv)
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *art, *im, *em;
int w, h;
ecore_init();
ecore_app_args_set(argc, (const char **)argv);
evas_init();
ecore_evas_init();
ecore_file_init();
emotion_init();
if (argc != 2) exit (2);
//ecore_main_loop_begin();
char *file = argv[1];
printf("file is %s\n", file);
ee = ecore_evas_buffer_new(1, 1);
evas = ecore_evas_get(ee);
evas_image_cache_set(evas, 0);
em = emotion_object_add(evas);
emotion_object_init(em, NULL);
emotion_object_file_set(em, file);
im = emotion_file_meta_artwork_get(em, file, EMOTION_ARTWORK_PREVIEW_IMAGE);
if (!im) goto out;
evas_object_image_size_get(im, &w, &h);
evas_object_image_fill_set(im, 0, 0, w, h);
evas_object_move(im, 0, 0);
evas_object_resize(im, w, h);
//evas_object_show(im);
evas_object_image_save(im, "file.jpg", NULL, NULL);
evas_object_del(em);
evas_object_del(im);
out:
fprintf(stderr, "OUT!\n");
emotion_shutdown();
ecore_evas_shutdown();
ecore_shutdown();
}

this may not be enough for couple of reasons:

  • no main loop is executed, from your bug report it seems like the main loop is cleaning up the file at a future point, which can be the problem;
  • image is not shown, not sure if this would impact this test or not, but evas is usually optimized enough to only use pixels of images that are visible, then you may be skipping those code paths that can trigger your bug