improve orientation fetch

we were generating some annoying messages
This commit is contained in:
John Cupitt 2016-06-01 08:59:44 +01:00
parent 7a91eaa583
commit 0012cefc25
5 changed files with 8 additions and 28 deletions

24
TODO
View File

@ -7,30 +7,6 @@
try other files in test/images
- try
http://www.camerafv5.com/files/photos/raw1/rope.dng
$ vips colourspace rope.dng 3.tif[compression=jpeg,Q=90,tile,tile-width=512,tile-height=512] srgb
tries to save a 16-bit image?
hangs 50% of the time, the other 50 it fails with a 16-bit error
save a 16-bit image to tiff with jpg compression ... should it autoconvert?
tiff should use convert for save in jpeg mode if jpeg compression is enabled
- try
$ vipsthumbnail ~/pics/*.jpg
vips warning: vips_image_get: field "orientation" not found
vips_image_get: field "orientation" not found
vips_image_get: field "orientation" not found
vips_image_get: field "orientation" not found
...
ugly!
- try adding a coz progress point to vipsthumbnail's main loop
see

View File

@ -76,7 +76,8 @@ vips_autorot_get_angle( VipsImage *im )
int orientation;
VipsAngle angle;
if( vips_image_get_int( im, VIPS_META_ORIENTATION, &orientation ) )
if( !vips_image_get_typeof( im, VIPS_META_ORIENTATION ) ||
vips_image_get_int( im, VIPS_META_ORIENTATION, &orientation ) )
orientation = 1;
switch( orientation ) {

View File

@ -2051,6 +2051,7 @@ vips__tiff_read_header_orientation( ReadTiff *rtiff, VipsImage *out )
int orientation;
if( rtiff->autorotate &&
vips_image_get_typeof( out, VIPS_META_ORIENTATION ) &&
!vips_image_get_int( out,
VIPS_META_ORIENTATION, &orientation ) ) {
if( orientation == 3 ||

View File

@ -543,7 +543,8 @@ set_exif_orientation( ExifData *ed, VipsImage *im )
/* We set the tag, even if it's been deleted, since it's a required
* field.
*/
if( vips_image_get_int( im, VIPS_META_ORIENTATION, &orientation ) )
if( !vips_image_get_typeof( im, VIPS_META_ORIENTATION ) ||
vips_image_get_int( im, VIPS_META_ORIENTATION, &orientation ) )
orientation = 1;
VIPS_DEBUG_MSG( "set_exif_orientation: %d\n", orientation );

View File

@ -585,8 +585,9 @@ write_tiff_header( Write *write, Layer *layer )
write_embed_imagedescription( write, tif ) )
return( -1 );
if( !vips_image_get_int( write->im,
VIPS_META_ORIENTATION, &orientation ) )
if( vips_image_get_typeof( write->im, VIPS_META_ORIENTATION ) &&
!vips_image_get_int( write->im,
VIPS_META_ORIENTATION, &orientation ) )
TIFFSetField( tif, TIFFTAG_ORIENTATION, orientation );
/* And colour fields.