Skip to main content

Imgsave

ImgSave​

Format​

imgsave file_name
imgsave ( file_name )
imgsave file_name, image_type
imgsave ( file_name, image_type )

Description​

Save the current Graphics Output Window to an image file.
By default the image is saved as a Portable Networks Graphics (PNG) file. You may optionally specify the image type as a “BMP”, “JPG”, “JPEG”, or “PNG”.

Return Values
ConstantValue
IMAGETYPE_BMP“BMP”
IMAGETYPE_JPG“JPG”
IMAGETYPE_PNG“BMP”

Sometimes images will be saved with “black” filling where the screen was undrawn. This is caused by the CLG statement setting the background to the color “clear” (transparent). When the image is saved the transparency is changed to black. Change your CLG statement to the following:

clg white

Example​

clg white
for t = 0 to 100
color rand()*256, rand()* 256, rand()*256
rect rand()*graphwidth, rand()*graphheight,rand()*graphwidth, rand()*graphheight
next t
imgsave "testimgsave1.png"
imgsave "testimgsave2.jpg", "jpg"

Permissions​

The file being written is checked. Saving into the program's own folder, or below it, happens with no question asked; saving elsewhere on the computer asks the user's permission, and the statement fails with ERROR_PERMISSION if that is refused. See File and Folder Permissions.

See Also​

Imgload, Imgsave

History​

0.9.6.45New To Version
1.99.99.58Added Named Constants