This commit is contained in:
John Cupitt 2008-04-09 22:09:10 +00:00
parent 4398c2d495
commit 18f79ab328
7 changed files with 35 additions and 5 deletions

View File

@ -7,6 +7,7 @@
- push Magick cflags earlier in the include order to make it easier to pick
GraphicsMagick over ImageMagick (thanks Mikhail)
- fix the en_GB translation
- use meta to preserve resunit between tiff load and save
25/1/08 started 7.14.0
- bump all version numbers for new stable

2
TODO
View File

@ -9,6 +9,8 @@
save as a tiff with res_inch
sets 10 pixels / inch ... wrong!
- test, backport to 7.14
- should check for gettext in configure? see
https://sourceforge.net/tracker/index.php?func=detail&aid=1836080&group_id=100050&atid=626186

View File

@ -39,6 +39,7 @@ extern "C" {
#define IM_META_EXIF_NAME "exif-data"
#define IM_META_ICC_NAME "icc-profile-data"
#define IM_META_XML "xml-header"
#define IM_META_RESOLUTION_UNIT "resolution-unit"
/* Types we add for meta fields.
*/

View File

@ -97,6 +97,8 @@
* - removed 'broken' read option
* 18/7/07 Andrey Kiselev
* - remove "b" option on TIFFOpen()
* 9/4/08
* - set IM_META_RESOLUTION_UNIT
*/
/*
@ -915,6 +917,8 @@ parse_resolution( TIFF *tiff, IMAGE *out )
*/
x /= 10.0 * 2.54;
y /= 10.0 * 2.54;
im_meta_set_string( out,
IM_META_RESOLUTION_UNIT, "in" );
break;
case RESUNIT_CENTIMETER:
@ -922,6 +926,8 @@ parse_resolution( TIFF *tiff, IMAGE *out )
*/
x /= 10.0;
y /= 10.0;
im_meta_set_string( out,
IM_META_RESOLUTION_UNIT, "cm" );
break;
default:
@ -931,8 +937,8 @@ parse_resolution( TIFF *tiff, IMAGE *out )
}
}
else {
im_warning( "im_tiff2vips: no resolution information for "
"TIFF image \"%s\" -- defaulting to 1 pixel per mm",
im_warn( "im_tiff2vips", _( "no resolution information for "
"TIFF image \"%s\" -- defaulting to 1 pixel per mm" ),
TIFFFileName( tiff ) );
x = 1.0;
y = 1.0;

View File

@ -100,6 +100,8 @@
* - use tiff error handler from im_tiff2vips.c
* 27/2/08
* - don't try to copy icc profiles when building pyramids (thanks Joe)
* 9/4/08
* - use IM_META_RESOLUTION_UNIT to set default resunit
*/
/*
@ -1193,11 +1195,19 @@ make_tiff_write( IMAGE *im, const char *filename )
tw->embed = 0;
tw->icc_profile = NULL;
/* Output resolution settings default to VIPS-alike.
/* Output resolution settings ... default to VIPS-alike.
*/
tw->resunit = RESUNIT_CENTIMETER;
tw->xres = im->Xres * 10;
tw->yres = im->Yres * 10;
if( im_meta_get_string( im, IM_META_RESOLUTION_UNIT, &p ) &&
strcmp( p, "in" ) ) {
tw->resunit = RESUNIT_INCH;
tw->xres /= 2.54;
tw->yres /= 2.54;
// do I need this?
g_free( p );
}
/* Parse mode string.
*/
@ -1313,10 +1323,20 @@ make_tiff_write( IMAGE *im, const char *filename )
}
}
if( (q = im_getnextoption( &p )) ) {
if( im_isprefix( "res_cm", q ) )
if( im_isprefix( "res_cm", q ) ) {
if( tw->resunit == RESUNIT_INCH ) {
tw->xres /= 2.54;
tw->yres /= 2.54;
}
tw->resunit = RESUNIT_CENTIMETER;
else if( im_isprefix( "res_inch", q ) )
}
else if( im_isprefix( "res_inch", q ) ) {
if( tw->resunit == RESUNIT_CENTIMETER ) {
tw->xres *= 2.54;
tw->yres *= 2.54;
}
tw->resunit = RESUNIT_INCH;
}
else {
im_error( "im_vips2tiff", _( "unknown resolution unit "
"\"%s\"\nshould be one of \"res_cm\" or "

Binary file not shown.