diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2013-03-21 20:59:06 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2013-03-21 20:59:06 +0100 | 
| commit | 7fbd8d9feeaf2ce5823e31ba49ef0f72fd38c18e (patch) | |
| tree | b228f5b3310590aafb3a2c68e37f0f3a830bacd2 /src | |
| parent | 80e5cac53fa0869d6ccd1f65a916e280248eb409 (diff) | |
autorotate images based on EXIF orientation (with exif=1)
Diffstat (limited to 'src')
| -rw-r--r-- | src/imlib.c | 18 | 
1 files changed, 17 insertions, 1 deletions
| diff --git a/src/imlib.c b/src/imlib.c index 5514a34..42d9711 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -233,6 +233,10 @@ int feh_load_image(Imlib_Image * im, feh_file * file)  	char *tmpname = NULL;  	char *real_filename = NULL; +#ifdef HAVE_LIBEXIF +	ExifEntry *entry; +#endif +  	D(("filename is %s, image is %p\n", file->filename, im));  	if (!file || !file->filename) @@ -284,7 +288,19 @@ int feh_load_image(Imlib_Image * im, feh_file * file)  #ifdef HAVE_LIBEXIF  	file->ed = exif_get_data(file->filename); -#endif		 + +	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  	D(("Loaded ok\n"));  	return(1); | 
