You used to specify file formats and give them options like this:
meaning load the file myfile.v, then write it to newfile.tiff in TIFF format with jpeg compression.$ vips im_vips2tiff myfile.v newfile.tiff:jpeg
The vips8 equivalent is called tiffsave. If you run it with no arguments you get a nice help display:
and you can do the equivalent of the old vips7 command above like this:$ vips tiffsaveusage:
tiffsave in filename
where:
in - Image to save, input VipsImage
filename - Filename to save to, input gchararray
optional arguments:
compression - Compression for this file, input VipsTiffCompression
Q - Q factor, input gint
predictor - Compression prediction, input VipsTiffPredictor
profile - ICC profile to embed, input gchararray
tile - Write a tiled tiff, input gboolean
tile-width - Tile width in pixels, input gint
tile-height - Tile height in pixels, input gint
pyramid - Write a pyramidal tiff, input gboolean
squash - Squash images down to 1 bit, input gboolean
resunit - Resolution unit, input VipsTiffResunit
bigtiff - Write a bigtiff image, input gboolean
You can also embed options in the filename using the standard vips8 syntax. For example:$ vips tiffsave myfile.v newfile.tiff --compression jpeg
Which will load fred.jpg, invert it, then save as a jpeg-compressed tiff.$ vips invert fred.jpg jim.tif{compression=jpeg}
The old vips7 system is still there and working, though it's now just a thin skin over the new system, so it's fully backwards-compatible.
There's a very similar C API and it's also easy expressed in Python and C++. It's also easy to add support for new formats. We have preliminary documentation and source code available.
No comments:
Post a Comment