Commit 7fbd8d9f authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

autorotate images based on EXIF orientation (with exif=1)

parent 80e5cac5
Loading
Loading
Loading
Loading
+17 −1
Original line number Original line Diff line number Diff line
@@ -233,6 +233,10 @@ int feh_load_image(Imlib_Image * im, feh_file * file)
	char *tmpname = NULL;
	char *tmpname = NULL;
	char *real_filename = NULL;
	char *real_filename = NULL;


#ifdef HAVE_LIBEXIF
	ExifEntry *entry;
#endif

	D(("filename is %s, image is %p\n", file->filename, im));
	D(("filename is %s, image is %p\n", file->filename, im));


	if (!file || !file->filename)
	if (!file || !file->filename)
@@ -284,6 +288,18 @@ int feh_load_image(Imlib_Image * im, feh_file * file)


#ifdef HAVE_LIBEXIF
#ifdef HAVE_LIBEXIF
	file->ed = exif_get_data(file->filename);
	file->ed = exif_get_data(file->filename);

	if (file->ed) {
		entry = exif_content_get_entry(file->ed->ifd[EXIF_IFD_0], 0x0112);
		if (entry != NULL) {
			if (*(entry->data) == 3)
				gib_imlib_image_orientate(*im, 2);
			else if (*(entry->data) == 6)
				gib_imlib_image_orientate(*im, 1);
			else if (*(entry->data) == 8)
				gib_imlib_image_orientate(*im, 3);
		}
	}
#endif
#endif


	D(("Loaded ok\n"));
	D(("Loaded ok\n"));