"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libvips/foreign/tiffsave.c" between
vips-8.10.6.tar.gz and vips-8.11.0.tar.gz

About: VIPS is a free image processing system (see also the GUI nip2).

tiffsave.c  (vips-8.10.6):tiffsave.c  (vips-8.11.0)
skipping to change at line 29 skipping to change at line 29
* - add @level and @lossless * - add @level and @lossless
* 4/9/18 [f--f] * 4/9/18 [f--f]
* - xres/yres params were in pixels/cm * - xres/yres params were in pixels/cm
* 26/1/20 * 26/1/20
* - add "depth" to set pyr depth * - add "depth" to set pyr depth
* 12/5/20 * 12/5/20
* - add "subifd" to create pyr layers as sub-directories * - add "subifd" to create pyr layers as sub-directories
* 8/6/20 * 8/6/20
* - add bitdepth support for 2 and 4 bit greyscale images * - add bitdepth support for 2 and 4 bit greyscale images
* - deprecate "squash" * - deprecate "squash"
* 1/5/21
* - add "premultiply" flag
*/ */
/* /*
This file is part of VIPS. This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
skipping to change at line 108 skipping to change at line 110
double xres; double xres;
double yres; double yres;
gboolean bigtiff; gboolean bigtiff;
gboolean rgbjpeg; gboolean rgbjpeg;
gboolean properties; gboolean properties;
VipsRegionShrink region_shrink; VipsRegionShrink region_shrink;
int level; int level;
gboolean lossless; gboolean lossless;
VipsForeignDzDepth depth; VipsForeignDzDepth depth;
gboolean subifd; gboolean subifd;
gboolean premultiply;
} VipsForeignSaveTiff; } VipsForeignSaveTiff;
typedef VipsForeignSaveClass VipsForeignSaveTiffClass; typedef VipsForeignSaveClass VipsForeignSaveTiffClass;
G_DEFINE_ABSTRACT_TYPE( VipsForeignSaveTiff, vips_foreign_save_tiff, G_DEFINE_ABSTRACT_TYPE( VipsForeignSaveTiff, vips_foreign_save_tiff,
VIPS_TYPE_FOREIGN_SAVE ); VIPS_TYPE_FOREIGN_SAVE );
#define UC VIPS_FORMAT_UCHAR #define UC VIPS_FORMAT_UCHAR
/* Type promotion for save ... just always go to uchar. /* Type promotion for jpeg-in-tiff save ... just always go to uchar.
*/ */
static int bandfmt_jpeg[10] = { static int bandfmt_jpeg[10] = {
/* UC C US S UI I F X D DX */ /* UC C US S UI I F X D DX */
UC, UC, UC, UC, UC, UC, UC, UC, UC, UC UC, UC, UC, UC, UC, UC, UC, UC, UC, UC
}; };
static int static int
vips_foreign_save_tiff_build( VipsObject *object ) vips_foreign_save_tiff_build( VipsObject *object )
{ {
VipsForeignSaveClass *class = VIPS_FOREIGN_SAVE_GET_CLASS( object ); VipsForeignSaveClass *class = VIPS_FOREIGN_SAVE_GET_CLASS( object );
skipping to change at line 344 skipping to change at line 347
G_STRUCT_OFFSET( VipsForeignSaveTiff, lossless ), G_STRUCT_OFFSET( VipsForeignSaveTiff, lossless ),
FALSE ); FALSE );
VIPS_ARG_ENUM( class, "depth", 25, VIPS_ARG_ENUM( class, "depth", 25,
_( "Depth" ), _( "Depth" ),
_( "Pyramid depth" ), _( "Pyramid depth" ),
VIPS_ARGUMENT_OPTIONAL_INPUT, VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignSaveTiff, depth ), G_STRUCT_OFFSET( VipsForeignSaveTiff, depth ),
VIPS_TYPE_FOREIGN_DZ_DEPTH, VIPS_FOREIGN_DZ_DEPTH_ONETILE ); VIPS_TYPE_FOREIGN_DZ_DEPTH, VIPS_FOREIGN_DZ_DEPTH_ONETILE );
VIPS_ARG_BOOL( class, "subifd", 24, VIPS_ARG_BOOL( class, "subifd", 26,
_( "Sub-IFD" ), _( "Sub-IFD" ),
_( "Save pyr layers as sub-IFDs" ), _( "Save pyr layers as sub-IFDs" ),
VIPS_ARGUMENT_OPTIONAL_INPUT, VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignSaveTiff, subifd ), G_STRUCT_OFFSET( VipsForeignSaveTiff, subifd ),
FALSE ); FALSE );
VIPS_ARG_BOOL( class, "premultiply", 27,
_( "Premultiply" ),
_( "Save with premultiplied alpha" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignSaveTiff, premultiply ),
FALSE );
VIPS_ARG_BOOL( class, "rgbjpeg", 20, VIPS_ARG_BOOL( class, "rgbjpeg", 20,
_( "RGB JPEG" ), _( "RGB JPEG" ),
_( "Output RGB JPEG rather than YCbCr" ), _( "Output RGB JPEG rather than YCbCr" ),
VIPS_ARGUMENT_OPTIONAL_INPUT | VIPS_ARGUMENT_DEPRECATED, VIPS_ARGUMENT_OPTIONAL_INPUT | VIPS_ARGUMENT_DEPRECATED,
G_STRUCT_OFFSET( VipsForeignSaveTiff, rgbjpeg ), G_STRUCT_OFFSET( VipsForeignSaveTiff, rgbjpeg ),
FALSE ); FALSE );
VIPS_ARG_BOOL( class, "squash", 14, VIPS_ARG_BOOL( class, "squash", 14,
_( "Squash" ), _( "Squash" ),
_( "Squash images down to 1 bit" ), _( "Squash images down to 1 bit" ),
skipping to change at line 430 skipping to change at line 440
tiff->miniswhite, tiff->miniswhite,
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, save->strip,
tiff->region_shrink, tiff->region_shrink,
tiff->level, tiff->level,
tiff->lossless, tiff->lossless,
tiff->depth, tiff->depth,
tiff->subifd ) ) tiff->subifd,
tiff->premultiply ) )
return( -1 ); return( -1 );
return( 0 ); return( 0 );
} }
static void static void
vips_foreign_save_tiff_file_class_init( VipsForeignSaveTiffFileClass *class ) vips_foreign_save_tiff_file_class_init( VipsForeignSaveTiffFileClass *class )
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS( class ); GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *object_class = (VipsObjectClass *) class; VipsObjectClass *object_class = (VipsObjectClass *) class;
skipping to change at line 503 skipping to change at line 514
tiff->miniswhite, tiff->miniswhite,
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, save->strip,
tiff->region_shrink, tiff->region_shrink,
tiff->level, tiff->level,
tiff->lossless, tiff->lossless,
tiff->depth, tiff->depth,
tiff->subifd ) ) tiff->subifd,
tiff->premultiply ) )
return( -1 ); return( -1 );
blob = vips_blob_new( (VipsCallbackFn) vips_area_free_cb, obuf, olen ); blob = vips_blob_new( (VipsCallbackFn) vips_area_free_cb, obuf, olen );
g_object_set( object, "buffer", blob, NULL ); g_object_set( object, "buffer", blob, NULL );
vips_area_unref( VIPS_AREA( blob ) ); vips_area_unref( VIPS_AREA( blob ) );
return( 0 ); return( 0 );
} }
static void static void
skipping to change at line 570 skipping to change at line 582
* * @resunit: #VipsForeignTiffResunit for resolution unit * * @resunit: #VipsForeignTiffResunit for resolution unit
* * @xres: %gdouble horizontal resolution in pixels/mm * * @xres: %gdouble horizontal resolution in pixels/mm
* * @yres: %gdouble vertical resolution in pixels/mm * * @yres: %gdouble vertical resolution in pixels/mm
* * @bigtiff: %gboolean, write a BigTiff file * * @bigtiff: %gboolean, write a BigTiff file
* * @properties: %gboolean, set %TRUE to write an IMAGEDESCRIPTION tag * * @properties: %gboolean, set %TRUE to write an IMAGEDESCRIPTION tag
* * @region_shrink: #VipsRegionShrink How to shrink each 2x2 region. * * @region_shrink: #VipsRegionShrink How to shrink each 2x2 region.
* * @level: %gint, Zstd compression level * * @level: %gint, Zstd compression level
* * @lossless: %gboolean, WebP losssless mode * * @lossless: %gboolean, WebP losssless mode
* * @depth: #VipsForeignDzDepth how deep to make the pyramid * * @depth: #VipsForeignDzDepth how deep to make the pyramid
* * @subifd: %gboolean write pyr layers as sub-ifds * * @subifd: %gboolean write pyr layers as sub-ifds
* * @premultiply: %gboolean write premultiplied alpha
* *
* Write a VIPS image to a file as TIFF. * Write a VIPS image to a file as TIFF.
* *
* If @in has the #VIPS_META_PAGE_HEIGHT metadata item, this is assumed to be a * If @in has the #VIPS_META_PAGE_HEIGHT metadata item, this is assumed to be a
* "toilet roll" image. It will be * "toilet roll" image. It will be
* written as series of pages, each #VIPS_META_PAGE_HEIGHT pixels high. * written as series of pages, each #VIPS_META_PAGE_HEIGHT pixels high.
* *
* Use @compression to set the tiff compression. Currently jpeg, packbits, * Use @compression to set the tiff compression. Currently jpeg, packbits,
* fax4, lzw, none, deflate, webp and zstd are supported. The default is no * fax4, lzw, none, deflate, webp and zstd are supported. The default is no
* compression. * compression.
skipping to change at line 661 skipping to change at line 674
* the XMP tag. #VIPS_META_ORIENTATION (if set) is used to set the value of * the XMP tag. #VIPS_META_ORIENTATION (if set) is used to set the value of
* the orientation * the orientation
* tag. #VIPS_META_IPTC (if set) is used to set the value of the IPTC tag. * tag. #VIPS_META_IPTC (if set) is used to set the value of the IPTC tag.
* #VIPS_META_PHOTOSHOP_NAME (if set) is used to set the value of the PHOTOSHOP * #VIPS_META_PHOTOSHOP_NAME (if set) is used to set the value of the PHOTOSHOP
* tag. * tag.
* *
* By default, pyramid layers are saved as consecutive pages. * By default, pyramid layers are saved as consecutive pages.
* Set @subifd to save pyramid layers as sub-directories of the main image. * Set @subifd to save pyramid layers as sub-directories of the main image.
* Setting this option can improve compatibility with formats like OME. * Setting this option can improve compatibility with formats like OME.
* *
* Set @premultiply tio save with premultiplied alpha. Some programs, such as
* InDesign, will only work with premultiplied alpha.
*
* See also: vips_tiffload(), vips_image_write_to_file(). * See also: vips_tiffload(), vips_image_write_to_file().
* *
* Returns: 0 on success, -1 on error. * Returns: 0 on success, -1 on error.
*/ */
int int
vips_tiffsave( VipsImage *in, const char *filename, ... ) vips_tiffsave( VipsImage *in, const char *filename, ... )
{ {
va_list ap; va_list ap;
int result; int result;
skipping to change at line 707 skipping to change at line 723
* * @resunit: #VipsForeignTiffResunit for resolution unit * * @resunit: #VipsForeignTiffResunit for resolution unit
* * @xres: %gdouble horizontal resolution in pixels/mm * * @xres: %gdouble horizontal resolution in pixels/mm
* * @yres: %gdouble vertical resolution in pixels/mm * * @yres: %gdouble vertical resolution in pixels/mm
* * @bigtiff: %gboolean, write a BigTiff file * * @bigtiff: %gboolean, write a BigTiff file
* * @properties: %gboolean, set %TRUE to write an IMAGEDESCRIPTION tag * * @properties: %gboolean, set %TRUE to write an IMAGEDESCRIPTION tag
* * @region_shrink: #VipsRegionShrink How to shrink each 2x2 region. * * @region_shrink: #VipsRegionShrink How to shrink each 2x2 region.
* * @level: %gint, Zstd compression level * * @level: %gint, Zstd compression level
* * @lossless: %gboolean, WebP losssless mode * * @lossless: %gboolean, WebP losssless mode
* * @depth: #VipsForeignDzDepth how deep to make the pyramid * * @depth: #VipsForeignDzDepth how deep to make the pyramid
* * @subifd: %gboolean write pyr layers as sub-ifds * * @subifd: %gboolean write pyr layers as sub-ifds
* * @premultiply: %gboolean write premultiplied alpha
* *
* As vips_tiffsave(), but save to a memory buffer. * As vips_tiffsave(), but save to a memory buffer.
* *
* The address of the buffer is returned in @buf, the length of the buffer in * The address of the buffer is returned in @buf, the length of the buffer in
* @len. You are responsible for freeing the buffer with g_free() when you * @len. You are responsible for freeing the buffer with g_free() when you
* are done with it. * are done with it.
* *
* See also: vips_tiffsave(), vips_image_write_to_file(). * See also: vips_tiffsave(), vips_image_write_to_file().
* *
* Returns: 0 on success, -1 on error. * Returns: 0 on success, -1 on error.
 End of changes. 10 change blocks. 
4 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)