Bugzilla – Attachment 425443 Details for
Bug 150534
xzgv --exif-orient doesn't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
use libexif to read EXIF orientation for JPEG and TIFF
xzgv-0.9.1-exif-orient.patch (text/plain), 3.04 KB, created by
Joerg Reuter
on 2011-04-18 15:47:35 UTC
(
hide
)
Description:
use libexif to read EXIF orientation for JPEG and TIFF
Filename:
MIME Type:
Creator:
Joerg Reuter
Created:
2011-04-18 15:47:35 UTC
Size:
3.04 KB
patch
obsolete
>diff -Nurp xzgv-0.9.1.orig/src/backend.c xzgv-0.9.1/src/backend.c >--- xzgv-0.9.1.orig/src/backend.c 2007-09-09 02:37:14.000000000 +0200 >+++ xzgv-0.9.1/src/backend.c 2011-04-18 17:16:07.816226544 +0200 >@@ -31,6 +31,7 @@ > #include <string.h> > #include <time.h> > #include <gtk/gtk.h> >+#include <libexif/exif-data.h> > > #include "backend.h" > >@@ -234,6 +235,29 @@ public_info_update(im); > return(im); > } > >+int backend_get_orientation_from_file(char *filename) >+{ >+GdkPixbufFormat *imform; >+gchar *format; >+ExifData *ed; >+ExifEntry *entry; >+ExifByteOrder bo; >+ExifShort orient; >+static const ExifShort xzgv_orient[]={0,0,1,3,2,7,4,6,5}; >+ >+if((imform=gdk_pixbuf_get_file_info(filename,NULL,NULL))==NULL) return 0; >+if((format=gdk_pixbuf_format_get_name(imform))==NULL) return 0; >+if(!strcmp(format, "jpeg") || !strcmp(format, "tiff")) >+ { >+ if((ed=exif_data_new_from_file(filename))==NULL) return 0; >+ if((entry=exif_data_get_entry(ed,EXIF_TAG_ORIENTATION))==NULL) return 0; >+ if((orient=exif_get_short(entry->data,exif_data_get_byte_order(ed)))>sizeof(xzgv_orient)-1) return 0; >+ orient=xzgv_orient[orient]; >+ return (int)orient; >+ } >+return 0; >+} >+ > > /* render image at (x,y) in window (at actual size). > * This is a fairly high-level one, but most backends will probably >diff -Nurp xzgv-0.9.1.orig/src/backend.h xzgv-0.9.1/src/backend.h >--- xzgv-0.9.1.orig/src/backend.h 2007-09-09 02:49:12.000000000 +0200 >+++ xzgv-0.9.1/src/backend.h 2011-04-18 16:01:23.258541646 +0200 >@@ -30,6 +30,7 @@ extern xzgv_image *backend_create_image_ > extern xzgv_image *backend_create_image_from_data_destructively( > unsigned char *rgb,int w,int h); > extern xzgv_image *backend_create_image_from_file(char *filename); >+extern int backend_get_orientation_from_file(char *filename); > extern void backend_render_image_into_window(xzgv_image *image,GdkWindow *win, > int x,int y); > extern int backend_render_pixmap_for_image(xzgv_image *image,int x,int y); >diff -Nurp xzgv-0.9.1.orig/src/main.c xzgv-0.9.1/src/main.c >--- xzgv-0.9.1.orig/src/main.c 2009-02-22 22:17:57.000000000 +0100 >+++ xzgv-0.9.1/src/main.c 2011-04-18 16:00:16.450725940 +0200 >@@ -359,6 +359,8 @@ int origw,origh; > jpeg_exif_orient=0; > > ret=backend_create_image_from_file(file); /* use backend's loader */ >+if((ret != NULL) && use_exif_orient) jpeg_exif_orient=backend_get_orientation_from_file(file); >+ > origw=0; origh=0; > if(ret) > { >diff -Nurp xzgv-0.9.1.orig/src/Makefile xzgv-0.9.1/src/Makefile >--- xzgv-0.9.1.orig/src/Makefile 2011-04-18 17:19:38.087176466 +0200 >+++ xzgv-0.9.1/src/Makefile 2011-04-18 17:19:25.066437938 +0200 >@@ -9,8 +9,10 @@ > # This gets definitions for CC, CFLAGS, BINDIR etc. > include ../config.mk > >-CFLAGS+=`pkg-config --cflags gtk+-2.0` `pkg-config --cflags gdk-pixbuf-2.0` >-LDFLAGS+=`pkg-config --libs gtk+-2.0` `pkg-config --libs gdk-pixbuf-2.0` >+CFLAGS+=`pkg-config --cflags gtk+-2.0` `pkg-config --cflags gdk-pixbuf-2.0` `pkg-config --cflags libexif` >+ >+LDFLAGS+=`pkg-config --libs gtk+-2.0` `pkg-config --libs gdk-pixbuf-2.0` `pkg-config --libs libexif` >+ > > all: xzgv >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 150534
:
68395
|
408518
| 425443