ImageWriter

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
'''ImageWriter''' writes frames from a clip as a sequence of image files using the DevIL library (except when you choose the internal "ebmp" format).
+
'''ImageWriter''' writes frames from a clip as a sequence of image files using the [http://openil.sourceforge.net/DevIL 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.
 
Note that frames are not written to the output file until they are actually rendered by this filter.
Line 63: Line 63:
  
 
===== The EBMP Format =====
 
===== The EBMP Format =====
'''ImageWriter''' writes image files using [http://openil.sourceforge.net/ DevIL] (the Developer's Image Library), except when you choose the internal "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_spaces|color space]].
 
+
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_spaces|color space]].
+
  
 
For all other image formats (see {{FuncArg|type}} above), the input colorspace '''must''' be Y8, RGB24 or RGB32.
 
For all other image formats (see {{FuncArg|type}} above), the input colorspace '''must''' be Y8, RGB24 or RGB32.
Line 73: Line 71:
 
{| border="1"
 
{| border="1"
 
|-
 
|-
| v2.58
+
| v2.61
| added end=-num_frames
+
| DevIL library updated to 1.7.8.
 
|-
 
|-
 
| v2.60
 
| v2.60
Line 80: Line 78:
 
* ebmp supports all formats; greyscale added for all formats.
 
* ebmp supports all formats; greyscale added for all formats.
 
* add support for printf formating of filename string, default is ("%06d.%s", n, ext).
 
* add support for printf formating of filename string, default is ("%06d.%s", n, ext).
 +
|-
 +
| v2.58
 +
| added end=-num_frames
 
|}
 
|}
  

Revision as of 16:38, 9 January 2016

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:
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.60
  • ebmp supports all formats; greyscale added for all formats.
  • add support for printf formating of filename string, default is ("%06d.%s", n, ext).
v2.58 added end=-num_frames
Personal tools