1.. _imwri:
2
3ImageMagick Writer-Reader
4=========================
5
6ImageMagick Writer-Reader (IMWRI) is a plugin that can read and write many image formats.
7
8.. function:: Write(clip clip, string imgformat, string filename[, int firstnum=0, int quality=75, bint dither=True, string compression_type, bint overwrite=False, clip alpha])
9   :module: imwri
10
11   Supported input formats for writing:
12      ImageMagick with Quantum Depth 16 and HDRI: 8-16 bit integer, 32 bit float
13
14   Write will write each frame to disk as it's requested. If a frame is never requested it's also never written to disk.
15
16   Parameters:
17      clip
18         Input clip. RGB and Gray supported. See list for accepted inputs.
19
20      imgformat
21         The name of the output format. Examples of supported format strings are "JPEG", "PNG", and "DPX". Visit the ImageMagick website for a full list.
22
23      filename
24         The filename string must have one or more frame number substitutions. The syntax is printf style. For example "image%06d.png" or "/images/%d.jpg" is common usage.
25
26      firstnum
27         The first image number in the sequence to write.
28
29      quality
30         Quality adjustment for formats where it's applicable. Range is 0 to 100.
31
32      dither
33         Use Floyd–Steinberg dithering if the input needs to be reduced in depth.
34
35      compression_type
36         Select the specific compression type for *imgformats* that have more than one possible compression method. Recognized constants are:
37         Undefined, None, BZip, DXT1, DXT3, DXT5, Fax, Group4, JPEG, JPEG2000, LosslessJPEG, LZW, RLE, Zip, ZipS, Piz, Pxr24, B44, B44A, LZMA, JBIG1, JBIG2
38
39      overwrite
40         Overwrite already existing files. This option also disables the requirement that output filenames contain a number.
41
42      alpha
43         A grayscale clip containing the alpha channel for the image to write. Apart from being grayscale, its properties must be identical to the main *clip*.
44
45
46.. function:: Read(string[] filename[, int firstnum=0, bint mismatch=False, bint alpha=False, bint float_output = False])
47   :module: imwri
48
49   Possible output formats when reading: 8-16 bit integer and 32 bit float
50
51   Note that by default 8-16 bit images are returned as integer and 32 bit images as float. When reading half precision float images you have to manually set *float_output* to have the unmodified floating point range returned.
52
53   Read is a simple function for reading single or series of images and returning them as a clip.
54
55   Parameters:
56      filename
57         The filename argument has two main modes. Either it takes a list of 1 or more files to open in the given order, or it takes a single filename string with one or more frame number substitutions. The syntax is printf style. For example "image%06d.png" or "/images/%d.jpg" is common usage.
58
59      firstnum
60         The first image number to start reading from when reading a sequence.
61
62      mismatch
63         Allow reading of multiple images with different resolutions. If required and not set, an error will be generated.
64
65      alpha
66         Return the alpha channel from the read images as a separate grayscale clip. Note that an alpha channel clip is always returned when this parameter is set, even for image formats without support for it.
67
68      float_output
69         Always return the read image in a float format. Due to the output format guessing this option can be useful when reading half precision float images.