better default resolution for png load

see

https://github.com/lovell/sharp/issues/96
This commit is contained in:
John Cupitt 2014-11-04 09:38:21 +00:00
parent 5995fff130
commit cfcd819246
2 changed files with 8 additions and 5 deletions

View File

@ -1,3 +1,6 @@
4/11/14 started 7.42.0
- better default resolution for png load
25/7/14 started 7.41.0
- start working on --disable-deprecated
- fix pngload with libpng >1.6.1

View File

@ -339,15 +339,15 @@ png2vips_header( Read *read, VipsImage *out )
/* If we're an INTEL byte order machine and this is 16bits, we need
* to swap bytes.
*/
if( bit_depth > 8 && !vips_amiMSBfirst() )
if( bit_depth > 8 &&
!vips_amiMSBfirst() )
png_set_swap( read->pPng );
/* Get resolution. I'm not sure what we should do for UNKNOWN, since
* vips is always pixels/mm.
/* Get resolution. Default to 72 pixels per inch, the usual png value.
*/
unit_type = PNG_RESOLUTION_METER;
res_x = 1000;
res_y = 1000;
res_x = (72 / 2.54 * 100);
res_y = (72 / 2.54 * 100);
png_get_pHYs( read->pPng, read->pInfo, &res_x, &res_y, &unit_type );
switch( unit_type ) {
case PNG_RESOLUTION_METER: