image write
A command of a photo: writes its pixels to a file.
IMAGENAME write FILENAME ?-background COLOR? ?-format FORMAT? ?-from X1 Y1 ?X2 Y2?? ?-grayscale?
Description
Writes the bytes that data gives for the same options, in the PPM format unless -format names PNG or GIF; the name of the file has no part in the choice. The file opens through the file commands of the script, as for read.
Returns
An empty string.
Examples
% image create photo w -width 2 -height 1
> w put {{#ff0000 #0000ff}}
> w write w.png -format png
> image create photo w2 -file w.png
> file delete w.png
> w2 data
{#ff0000 #0000ff}
Errors
% image create photo w3; w3 write
wrong # args: should be "w3 write fileName ?-option value ...?"
-errorcode NONE
% image create photo w4; w4 write a.bmp -format bmp
image file format "bmp" is unknown
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.10