Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for images:i586
openSUSE:12.2:ARM
xzgv
xzgv-0.9.1-exif-orient.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xzgv-0.9.1-exif-orient.patch of Package xzgv
--- src/backend.c.orig +++ src/backend.c @@ -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 --- src/backend.h.orig +++ src/backend.h @@ -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); --- src/main.c.orig +++ src/main.c @@ -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) { --- src/Makefile.orig +++ src/Makefile @@ -9,8 +9,8 @@ # 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` `pkg-config --cflags x11` -LDFLAGS+=`pkg-config --libs gtk+-2.0` `pkg-config --libs gdk-pixbuf-2.0 ` `pkg-config --libs x11` +CFLAGS+=`pkg-config --cflags gtk+-2.0` `pkg-config --cflags gdk-pixbuf-2.0` `pkg-config --cflags libexif` `pkg-config --cflags x11` +LDFLAGS+=-lm `pkg-config --libs gtk+-2.0` `pkg-config --libs gdk-pixbuf-2.0 ` `pkg-config --libs libexif` `pkg-config --libs x11` all: xzgv
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor