ImageWriter
ImageWriter writes frames from a clip as a sequence of image files using the library (except when you choose the internal "ebmp" format).
Note that frames are not written to the output file until they are actually rendered by this filter.
Syntax and Parameters
ImageWriter(clip clip, string file, int start, int [-]end, string type, bool info)
- string file = "c:\"
- The path + filename prefix of the saved images.
- The images will have file names with the pattern: file000000.type, file000001.type, etc.
- Sprintf formatting of the filenames is supported.
- By default, images will be saved as C:\000000.ebmp, C:\000001.ebmp, etc.
- int start = 0
- int end = 0
- The start and end of the frame range that will be written.
- They both default to 0 (where end=0 means last frame).
- If end is negative, it specifies the number of frames that will be written.
- string type = "ebmp"
- Set the filename extension and the format of the image.
- The supported values for type are:
- bmp and ebmp (ImageWriter native format);
- dds; jpg/jpe/jpeg; pcx; png;
- pbm/pgm/ppm; tga; tif/tiff;
- raw; sgi/bw/rgb/rgba
- The supported values for type are:
- Set the filename extension and the format of the image.
- bool info = false
- When true, overlay progress information on the video clip, showing whether a file is being written, and if so, the filename.
Examples
# Export the entire clip in the current native AviSynth format ImageWriter("D:\backup-stills\myvideo")
# Write frame 5 to "C:\000005.PNG" ImageWriter("", 5, 5, "png")
# Write frames 100 till the end to "F:\pic-000100.JPEG", "F:\pic-000101.JPEG", etc. # and display progress info ImageWriter(file = "F:\pic-", start = 100, type = "jpeg", info = true)
# Write a jpg as greyscale (note the luma range should be [0,255], not [16,235]) ImageSource("F:\TestPics\GoldPetals.jpg") ConvertToY8(matrix="PC.601") ImageWriter("F:\TestPics\GoldPetals-8bit-avs", type = "png")
# Write a jpg as YV24 ebmp (note the luma range should be [0,255], not [16,235]) ImageSource("F:\TestPics\GoldPetals.jpg") ConvertToYV24(matrix="PC.601") ImageWriter("F:\TestPics\GoldPetals-24bit", type = "ebmp")
# Write all frames to "F:\00.bmp", "F:\01.bmp", ..., "F:\10.bmp", "F:\11.bmp", ..., "F:\100.bmp", ... #(thus adding zeros filling two digits) ImageWriter(file="F:\%02d.bmp")
Notes
Saving as greyscale bmp doesn't work correctly, both for bmp (where DevIL is used) and ebmp (internal parsing). [todo: find out why]
The EBMP Format
The internal image format "ebmp" supports all color spaces. The "ebmp" files written from the RGB or Y8 color spaces are standard BMP files, but those produced from YUV spaces are special and can probably only be read by AviSynth's ImageSource. This special format allows you to save and reload raw video in any color space.
For all other image formats (see type above), the input colorspace must be Y8, RGB24 or RGB32.
Changelog
v2.61 | DevIL library updated to 1.7.8. |
v2.61 | DevIL.dll is now delay loaded, so Avisynth.dll can be used without it, in which case ImageReader/Writer would support only ebmp mode. |
v2.60 |
|
v2.58 | added end=-num_frames |