Skip to content

SaveImage

Narta Xaymar Dirks edited this page Oct 31, 2026 · 7 revisions

Blitz3DBlitzPlusBlitzBasic

SaveImage

SaveImage:Int32 image:Int32, bmpfile:String, frame:Int32=0
Parameter Mode Type Default Description
image In Int32 required The image.
bmpfile In String required
frame In Int32 0 The frame to save. Defaults to 0.

Returns: 1 if the file was written, otherwise 0. With AsyncSaving on, 1 means that the save was queued, see SavesFailed.

Description

Writes one frame of an image into a picture file. The format comes from the end of the file name, as for SaveBuffer: .bmp, .png, .jpg, .webp, .jxl, .tga and .dds, and any other name is a BMP. If the image has see-through pixels, PNG, WebP, JPEG XL, TGA, DDS and BMP files keep them (JPEG has no alpha). The optional settings choose how the file is made, see Saving pictures.

Differences

  • The original only writes BMP files. Here the ending of the name picks PNG, JPEG, WebP, JPEG XL, TGA, DDS or BMP, and the settings argument is new.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local img = CreateImage(64, 64)
SetBuffer ImageBuffer(img)
Color 255, 255, 0
Oval 0, 0, 64, 64, 1
SetBuffer BackBuffer()
If SaveImage(img, "saved.png") Then Print "saved.png written" Else Print "could not save"
SaveImage img, "saved.webp", 0, "lossless=1"
WaitKey

Related Commands

CopyImage, CreateImage, DrawImage, FreeImage, GrabImage, HandleImage, LoadAnimImage, LoadImage

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally