diff --git a/ChangeLog b/ChangeLog index 3ee31395..8b5b75d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ - ensure SVG loader skips input with chars outside x09-x7F range [lovell] - better mask sizing in gaussmat [johntrunc] - fix tiffsave "squash" handling [barryspearce] +- fix jpegload autorotate [chregu] 24/1/20 started 8.10.0 - more conformat IIIF output from dzsave [regisrob] diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index c1e87fd5..80964ecc 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -837,7 +837,7 @@ read_jpeg_image( ReadJpeg *jpeg, VipsImage *out ) { struct jpeg_decompress_struct *cinfo = &jpeg->cinfo; VipsImage **t = (VipsImage **) - vips_object_local_array( VIPS_OBJECT( out ), 4 ); + vips_object_local_array( VIPS_OBJECT( out ), 5 ); VipsImage *im; @@ -872,11 +872,13 @@ read_jpeg_image( ReadJpeg *jpeg, VipsImage *out ) if( jpeg->autorotate && vips_image_get_orientation( im ) != 1 ) { - /* This will go via a huge memory buffer :-( + /* We have to copy to memory before calling autorot, since it + * needs random access. */ - if( vips_autorot( im, &t[3], NULL ) ) + if( !(t[3] = vips_image_copy_memory( im )) || + vips_autorot( t[3], &t[4], NULL ) ) return( -1 ); - im = t[3]; + im = t[4]; } if( vips_image_write( im, out ) )