move orientation tag from vipsthumbnail output

This commit is contained in:
John Cupitt 2014-03-06 23:24:46 +00:00
parent fce4f2d1ef
commit 40a15b3aa0
3 changed files with 16 additions and 10 deletions

10
TODO
View File

@ -1,7 +1,11 @@
- we vips_image_remove() orientation, but it gets put back from the exif block
on jpegsave
- vipsthumbnail needs to know about more exif orientation tags
jpegsave needs to remove again after reconstituting the exif
- vipsthumbnail --rotate breaks for embedded thumbnail sources
embedded thumbnails seems to have had the orientation applied already
need to not copy orientation tag from main to thumb? is this right for all
images?
- think of a better way to support skipahead

View File

@ -569,6 +569,7 @@ vips_exif_from_s( ExifData *ed, ExifEntry *entry, const char *value )
typedef struct _VipsExif {
VipsImage *image;
ExifData *ed;
ExifContent *content;
} VipsExif;
static void
@ -584,11 +585,14 @@ vips_exif_update_entry( ExifEntry *entry, VipsExif *ve )
(void) vips_image_get_string( ve->image, name, &value );
vips_exif_from_s( ve->ed, entry, value );
}
else
exif_content_remove_entry( ve->content, entry );
}
static void
vips_exif_update_content( ExifContent *content, VipsExif *ve )
{
ve->content = content;
exif_content_foreach_entry( content,
(ExifContentForeachEntryFunc) vips_exif_update_entry, ve );
}

View File

@ -139,11 +139,10 @@ get_angle( VipsImage *im )
angle = VIPS_ANGLE_0;
if( vips_image_get_typeof( im, ORIENTATION ) ) {
if( vips_image_get_string( im, ORIENTATION, &orientation ) ) {
if( vips_isprefix( "6", orientation ) )
angle = VIPS_ANGLE_90;
}
if( vips_image_get_typeof( im, ORIENTATION ) &&
!vips_image_get_string( im, ORIENTATION, &orientation ) ) {
if( vips_isprefix( "6", orientation ) )
angle = VIPS_ANGLE_90;
}
return( angle );
@ -636,8 +635,7 @@ thumbnail_rotate( VipsObject *process, VipsImage *im )
return( NULL );
im = t[0];
if( !vips_image_remove( im, ORIENTATION ) )
return( NULL );
(void) vips_image_remove( im, ORIENTATION );
}
return( im );