zooui.converters.vipsconverter module¶
Image converter based upon libvips (via pyvips).
- class zooui.converters.vipsconverter.VipsConverter(infile, outfile, rotation=0, invert_colors=False, black_and_white=False)[source]¶
Bases:
Converter- Constructor :
VipsConverter(infile, outfile, rotation=0, invert_colors=False, black_and_white=False)
- Parameters :
infile : str outfile : str rotation : int (0, 90, 180, or 270) invert_colors : bool black_and_white : bool
VipsConverter(infile, outfile, rotation=0, invert_colors=False, black_and_white=False) –> None
VipsConverter objects are used for converting media with libvips. libvips is a fast image processing library that can handle very large images with low memory usage. For a list of supported image formats see https://www.libvips.org/API/current/file-format.html
- Constructor :
VipsConverter(infile, outfile, rotation, invert_colors, black_and_white)
- Parameters :
infile : str outfile : str rotation : Literal[0, 90, 180, 270] invert_colors : bool black_and_white : bool
VipsConverter(infile, outfile, rotation, invert_colors, black_and_white) –> None
Create a new VipsConverter for converting media files using libvips.
The infile parameter is the path to the source image file. The outfile parameter is the path where the converted PPM will be written. The rotation parameter specifies rotation angle in degrees (0, 90, 180, or 270). The invert_colors parameter enables color inversion when True. The black_and_white parameter enables grayscale conversion when True.
- run()[source]¶
- Method :
VipsConverter.run()
- Parameters :
None
VipsConverter.run() –> None
Run the conversion using libvips. Loads the image from the input file, converts it to the appropriate format (8-bit RGB or grayscale), and writes it to the output file in PPM format.
If any errors are encountered then
self.errorwill be set to a string describing the error.