Simp module

bitmap_save

procedureSource

Writes bitmap to an image file. Returns false for any other extension, for a bitmap that is not RGB8 or RGBA8, or when the write fails.

Example
bitmap: Bitmap;
bitmap_alloc(*bitmap, 16, 16, .RGB8);
defer deinit(*bitmap);
bitmap_save(*bitmap, "out.png");

This one is only checked to compile, not run.

bitmap_save :: (bitmap: *Bitmap, filepath: string, save_alpha := false) -> bool

Writes bitmap to an image file. Returns false for any other extension, for a bitmap that is not RGB8 or RGBA8, or when the write fails.

Parameters

bitmap: *Bitmap
filepath: string
where to write. The extension picks the format: .png, .bmp, .tga, .jpg or .jpeg.
save_alpha := false
keeps the alpha channel of an RGBA8 bitmap. Off by default, which writes RGB.

Returns

bool
Example
bitmap: Bitmap;
bitmap_alloc(*bitmap, 16, 16, .RGB8);
defer deinit(*bitmap);
bitmap_save(*bitmap, "out.png");

This one is only checked to compile, not run.

See also