better handling of JFIF res unit 0
res unit 0 sets the aspect ratio, rather than being unitless thanks angelmixu see https://github.com/libvips/libvips/issues/1641
This commit is contained in:
parent
8281416ca4
commit
77365a8a6f
@ -106,6 +106,8 @@
|
||||
* - restart after minimise
|
||||
* 14/10/19
|
||||
* - revise for source IO
|
||||
* 5/5/20 angelmixu
|
||||
* - better handling of JFIF res unit 0
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -512,16 +514,17 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
|
||||
cinfo->X_density != 1U &&
|
||||
cinfo->Y_density != 1U ) {
|
||||
#ifdef DEBUG
|
||||
printf( "read_jpeg_header: seen jfif _density %d, %d\n",
|
||||
cinfo->X_density, cinfo->Y_density );
|
||||
printf( "read_jpeg_header: jfif _density %d, %d, unit %d\n",
|
||||
cinfo->X_density, cinfo->Y_density,
|
||||
cinfo->density_unit );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
switch( cinfo->density_unit ) {
|
||||
case 0:
|
||||
/* None. Just set.
|
||||
/* X_density / Y_density gives the pixel aspect ratio.
|
||||
* Leave xres, but adjust yres.
|
||||
*/
|
||||
xres = cinfo->X_density;
|
||||
yres = cinfo->Y_density;
|
||||
yres = xres * cinfo->X_density / cinfo->Y_density;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
Loading…
Reference in New Issue
Block a user