Skip to content

SaveTexture

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

SaveTexture 〔BlitzLLVM〕

SaveTexture:Int32 texture:Int32, file:String, frame:Int32=0, settings:String=\
Parameter Mode Type Default Description
texture In Int32 required The texture.
file In String required The path of the file to write.
frame In Int32 0 The frame to save. Defaults to 0.
settings In String \ How to encode the file, such as "quality=85". Defaults to an empty string.

Returns: 1 if the file was written, otherwise 0 (also for a frame that the texture does not have). With AsyncSaving on, 1 means that the save was queued, see SavesFailed.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Writes one frame of a texture into a picture file, the same as saving its TextureBuffer with SaveBuffer. The format comes from the end of the file name (.bmp, .png, .jpg, .webp, .jxl, .tga, .dds, any other name is a BMP), and the optional settings choose how the file is made, see Saving pictures.

Examples

Graphics3D 320, 240, 0, 2
tex = CreateTexture(64, 64)
SetBuffer TextureBuffer(tex)
Color 255, 128, 0
Rect 0, 0, 64, 64, 1
Color 255, 255, 255
Oval 8, 8, 48, 48, 1
SetBuffer BackBuffer()
If SaveTexture(tex, "texture.png") Then Print "texture.png written" Else Print "could not save"
SaveTexture tex, "texture.jpg", 0, "quality=95,subsampling=444"
WaitKey

This is a BlitzLLVM extension: the originals can only save buffers and images.

Related Commands

AtlasTexture, CreateTexture, FreeTexture, LoadAnimTexture, LoadTexture, PositionTexture, RotateTexture, ScaleTexture

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally