|
Lines 31-36
Link Here
|
| 31 |
#include <string.h> |
31 |
#include <string.h> |
| 32 |
#include <time.h> |
32 |
#include <time.h> |
| 33 |
#include <gtk/gtk.h> |
33 |
#include <gtk/gtk.h> |
|
|
34 |
#include <libexif/exif-data.h> |
| 34 |
|
35 |
|
| 35 |
#include "backend.h" |
36 |
#include "backend.h" |
| 36 |
|
37 |
|
|
Lines 234-239
public_info_update(im);
Link Here
|
| 234 |
return(im); |
235 |
return(im); |
| 235 |
} |
236 |
} |
| 236 |
|
237 |
|
|
|
238 |
int backend_get_orientation_from_file(char *filename) |
| 239 |
{ |
| 240 |
GdkPixbufFormat *imform; |
| 241 |
gchar *format; |
| 242 |
ExifData *ed; |
| 243 |
ExifEntry *entry; |
| 244 |
ExifByteOrder bo; |
| 245 |
ExifShort orient; |
| 246 |
static const ExifShort xzgv_orient[]={0,0,1,3,2,7,4,6,5}; |
| 247 |
|
| 248 |
if((imform=gdk_pixbuf_get_file_info(filename,NULL,NULL))==NULL) return 0; |
| 249 |
if((format=gdk_pixbuf_format_get_name(imform))==NULL) return 0; |
| 250 |
if(!strcmp(format, "jpeg") || !strcmp(format, "tiff")) |
| 251 |
{ |
| 252 |
if((ed=exif_data_new_from_file(filename))==NULL) return 0; |
| 253 |
if((entry=exif_data_get_entry(ed,EXIF_TAG_ORIENTATION))==NULL) return 0; |
| 254 |
if((orient=exif_get_short(entry->data,exif_data_get_byte_order(ed)))>sizeof(xzgv_orient)-1) return 0; |
| 255 |
orient=xzgv_orient[orient]; |
| 256 |
return (int)orient; |
| 257 |
} |
| 258 |
return 0; |
| 259 |
} |
| 260 |
|
| 237 |
|
261 |
|
| 238 |
/* render image at (x,y) in window (at actual size). |
262 |
/* render image at (x,y) in window (at actual size). |
| 239 |
* This is a fairly high-level one, but most backends will probably |
263 |
* This is a fairly high-level one, but most backends will probably |