fix jpegload autorotate

thanks chregu

see https://github.com/libvips/php-vips/issues/105
This commit is contained in:
John Cupitt 2020-09-03 19:31:56 +01:00
parent 20a5448da1
commit a88061dfec
2 changed files with 7 additions and 4 deletions

View File

@ -7,6 +7,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]

View File

@ -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 ) )