Method
VipsImagetiffsave
Declaration [src]
int
vips_tiffsave (
VipsImage* in,
const char* filename,
...
)
Description [src]
Optional arguments:
compression
: use thisVipsForeignTiffCompression
Q
: %gint quality factorpredictor
: use thisVipsForeignTiffPredictor
tile
: %gboolean, setTRUE
to write a tiled tifftile_width
: %gint for tile sizetile_height
: %gint for tile sizepyramid
: %gboolean, write an image pyramidbitdepth
: %int, change bit depth to 1,2, or 4 bitminiswhite
: %gboolean, write 1-bit images as MINISWHITEresunit
:VipsForeignTiffResunit
for resolution unitxres
: %gdouble horizontal resolution in pixels/mmyres
: %gdouble vertical resolution in pixels/mmbigtiff
: %gboolean, write a BigTiff fileproperties
: %gboolean, setTRUE
to write an IMAGEDESCRIPTION tagregion_shrink
:VipsRegionShrink
How to shrink each 2x2 region.level
: %gint, Zstd or Deflate (zlib) compression levellossless
: %gboolean, WebP lossless modedepth
:VipsForeignDzDepth
how deep to make the pyramidsubifd
: %gboolean write pyr layers as sub-ifdspremultiply
: %gboolean write premultiplied alpha
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
“toilet roll” image. It will be
written as series of pages, each #VIPS_META_PAGE_HEIGHT pixels high.
Use compression
to set the tiff compression. Currently jpeg, packbits,
fax4, lzw, none, deflate, webp and zstd are supported. The default is no
compression.
JPEG compression is a good lossy compressor for photographs, packbits is
good for 1-bit images, and deflate is the best lossless compression TIFF
can do.
XYZ images are automatically saved as libtiff LOGLUV with SGILOG compression.
Float LAB images are saved as float CIELAB. Set bitdepth
to save as 8-bit
CIELAB.
Use Q
to set the JPEG compression factor. Default 75.
User level
to set the ZSTD (1-22) or Deflate (1-9) compression level. Use lossless
to
set WEBP lossless mode on. Use Q
to set the WEBP compression level.
Use predictor
to set the predictor for lzw, deflate and zstd compression.
It defaults to #VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL, meaning horizontal
differencing. Please refer to the libtiff
specifications for further discussion of various predictors.
Set tile
to TRUE to write a tiled tiff. By default tiff are written in
strips. Use tile_width
and tile_height
to set the tile size. The defaiult
is 128 by 128.
Set pyramid
to write the image as a set of images, one per page, of
decreasing size. Use region_shrink
to set how images will be shrunk: by
default each 2x2 block is just averaged, but you can set MODE or MEDIAN as well.
By default, the pyramid stops when the image is small enough to fit in one
tile. Use depth
to stop when the image fits in one pixel, or to only write
a single layer.
Set bitdepth
to save 8-bit uchar images as 1, 2 or 4-bit TIFFs.
In case of depth 1: Values >128 are written as white, values <=128 as black.
Normally vips will write MINISBLACK TIFFs where black is a 0 bit, but if you
set miniswhite
, it will use 0 for a white bit. Many pre-press applications
only work with images which use this sense. miniswhite
only affects one-bit
images, it does nothing for greyscale images.
In case of depth 2: The same holds but values < 64 are written as black.
For 64 <= values < 128 they are written as dark grey, for 128 <= values < 192
they are written as light gray and values above are written as white.
In case miniswhite
is set to true this behavior is inverted.
In case of depth 4: values < 16 are written as black, and so on for the
lighter shades. In case miniswhite
is set to true this behavior is inverted.
Use resunit
to override the default resolution unit.
The default
resolution unit is taken from the header field
VIPS_META_RESOLUTION_UNIT. If this field is not set, then
VIPS defaults to cm.
Use xres
and yres
to override the default horizontal and vertical
resolutions. By default these values are taken from the VIPS image header.
libvips resolution is always in pixels per millimetre.
Set bigtiff
to attempt to write a bigtiff. Bigtiff is a variant of the TIFF
format that allows more than 4GB in a file.
Set properties
to write all vips metadata to the IMAGEDESCRIPTION tag as
xml. If properties
is not set, the value of #VIPS_META_IMAGEDESCRIPTION is
used instead.
The value of #VIPS_META_XMP_NAME is written to the XMP tag. #VIPS_META_ORIENTATION (if set) is used to set the value of the orientation 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
tag.
By default, pyramid layers are saved as consecutive pages.
Set subifd
to save pyramid layers as sub-directories of the main image.
Setting this option can improve compatibility with formats like OME.
Set premultiply
to save with premultiplied alpha. Some programs, such as
InDesign, will only work with premultiplied alpha.
See also: vips_tiffload(), vips_image_write_to_file().
This method is not directly available to language bindings.