support --strip for tiffsave

stops metadata save
This commit is contained in:
John Cupitt 2016-06-02 13:14:15 +01:00
parent ff8f6364a4
commit c5a4afbe40
5 changed files with 28 additions and 19 deletions

View File

@ -12,6 +12,7 @@
- support tiff orientation tag - support tiff orientation tag
- autorotate option for tiff load - autorotate option for tiff load
- tiffsave converts for jpg if jpg compression is turned on - tiffsave converts for jpg if jpg compression is turned on
- tiffsave supports --strip
18/5/16 started 8.3.2 18/5/16 started 8.3.2
- more robust vips image reading - more robust vips image reading

2
TODO
View File

@ -1,5 +1,3 @@
- tiff write does not support [strip]
- add more webp tests to py suite - add more webp tests to py suite
- try moving some more of the CLI tests to py - try moving some more of the CLI tests to py

View File

@ -50,7 +50,8 @@ int vips__tiff_write( VipsImage *in, const char *filename,
VipsForeignTiffResunit resunit, double xres, double yres, VipsForeignTiffResunit resunit, double xres, double yres,
gboolean bigtiff, gboolean bigtiff,
gboolean rgbjpeg, gboolean rgbjpeg,
gboolean properties ); gboolean properties,
gboolean strip );
int vips__tiff_read_header( const char *filename, VipsImage *out, int vips__tiff_read_header( const char *filename, VipsImage *out,
int page, gboolean autorotate ); int page, gboolean autorotate );

View File

@ -166,7 +166,8 @@ vips_foreign_save_tiff_build( VipsObject *object )
tiff->resunit, tiff->xres, tiff->yres, tiff->resunit, tiff->xres, tiff->yres,
tiff->bigtiff, tiff->bigtiff,
tiff->rgbjpeg, tiff->rgbjpeg,
tiff->properties ) ) tiff->properties,
save->strip ) )
return( -1 ); return( -1 );
return( 0 ); return( 0 );
@ -353,6 +354,7 @@ vips_foreign_save_tiff_init( VipsForeignSaveTiff *tiff )
* * @yres: %gdouble vertical resolution in pixels/mm * * @yres: %gdouble vertical resolution in pixels/mm
* * @bigtiff: set %TRUE to write a BigTiff file * * @bigtiff: set %TRUE to write a BigTiff file
* * @properties: set %TRUE to write an IMAGEDESCRIPTION tag * * @properties: set %TRUE to write an IMAGEDESCRIPTION tag
* * @strip: set %TRUE to block metadata save
* *
* Write a VIPS image to a file as TIFF. * Write a VIPS image to a file as TIFF.
* *

View File

@ -160,6 +160,8 @@
* - better alpha handling, thanks sadaqatullahn * - better alpha handling, thanks sadaqatullahn
* 21/12/15 * 21/12/15
* - write TIFFTAG_IMAGEDESCRIPTION * - write TIFFTAG_IMAGEDESCRIPTION
* 2/6/16
* - support strip option
*/ */
/* /*
@ -278,6 +280,7 @@ struct _Write {
int bigtiff; /* True for bigtiff write */ int bigtiff; /* True for bigtiff write */
int rgbjpeg; /* True for RGB not YCbCr */ int rgbjpeg; /* True for RGB not YCbCr */
int properties; /* Set to save XML props */ int properties; /* Set to save XML props */
int strip; /* Don't write metadata */
}; };
/* Open TIFF for output. /* Open TIFF for output.
@ -578,12 +581,13 @@ write_tiff_header( Write *write, Layer *layer )
TIFFSetField( tif, TIFFTAG_YRESOLUTION, TIFFSetField( tif, TIFFTAG_YRESOLUTION,
VIPS_FCLIP( 0.01, write->yres, 1000000 ) ); VIPS_FCLIP( 0.01, write->yres, 1000000 ) );
if( write_embed_profile( write, tif ) || if( !write->strip )
write_embed_xmp( write, tif ) || if( write_embed_profile( write, tif ) ||
write_embed_ipct( write, tif ) || write_embed_xmp( write, tif ) ||
write_embed_photoshop( write, tif ) || write_embed_ipct( write, tif ) ||
write_embed_imagedescription( write, tif ) ) write_embed_photoshop( write, tif ) ||
return( -1 ); write_embed_imagedescription( write, tif ) )
return( -1 );
if( vips_image_get_typeof( write->im, VIPS_META_ORIENTATION ) && if( vips_image_get_typeof( write->im, VIPS_META_ORIENTATION ) &&
!vips_image_get_int( write->im, !vips_image_get_int( write->im,
@ -875,7 +879,8 @@ write_new( VipsImage *im, const char *filename,
VipsForeignTiffResunit resunit, double xres, double yres, VipsForeignTiffResunit resunit, double xres, double yres,
gboolean bigtiff, gboolean bigtiff,
gboolean rgbjpeg, gboolean rgbjpeg,
gboolean properties ) gboolean properties,
gboolean strip )
{ {
Write *write; Write *write;
@ -898,6 +903,7 @@ write_new( VipsImage *im, const char *filename,
write->bigtiff = bigtiff; write->bigtiff = bigtiff;
write->rgbjpeg = rgbjpeg; write->rgbjpeg = rgbjpeg;
write->properties = properties; write->properties = properties;
write->strip = strip;
write->resunit = get_resunit( resunit ); write->resunit = get_resunit( resunit );
write->xres = xres; write->xres = xres;
@ -1541,12 +1547,13 @@ write_copy_tiff( Write *write, TIFF *out, TIFF *in )
/* We can't copy profiles or xmp :( Set again from Write. /* We can't copy profiles or xmp :( Set again from Write.
*/ */
if( write_embed_profile( write, out ) || if( !write->strip )
write_embed_xmp( write, out ) || if( write_embed_profile( write, out ) ||
write_embed_ipct( write, out ) || write_embed_xmp( write, out ) ||
write_embed_photoshop( write, out ) || write_embed_ipct( write, out ) ||
write_embed_imagedescription( write, out ) ) write_embed_photoshop( write, out ) ||
return( -1 ); write_embed_imagedescription( write, out ) )
return( -1 );
buf = vips_malloc( NULL, TIFFTileSize( in ) ); buf = vips_malloc( NULL, TIFFTileSize( in ) );
n = TIFFNumberOfTiles( in ); n = TIFFNumberOfTiles( in );
@ -1613,7 +1620,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
VipsForeignTiffResunit resunit, double xres, double yres, VipsForeignTiffResunit resunit, double xres, double yres,
gboolean bigtiff, gboolean bigtiff,
gboolean rgbjpeg, gboolean rgbjpeg,
gboolean properties ) gboolean properties, gboolean strip )
{ {
Write *write; Write *write;
@ -1632,7 +1639,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
compression, Q, predictor, profile, compression, Q, predictor, profile,
tile, tile_width, tile_height, pyramid, squash, tile, tile_width, tile_height, pyramid, squash,
miniswhite, resunit, xres, yres, bigtiff, rgbjpeg, miniswhite, resunit, xres, yres, bigtiff, rgbjpeg,
properties )) ) properties, strip )) )
return( -1 ); return( -1 );
if( vips_sink_disc( write->im, write_strip, write ) ) { if( vips_sink_disc( write->im, write_strip, write ) ) {