Skip to content

stbi #

Description:

stbi is a thin wrapper around stb's stb_image.h, which in turn is "a public domain image loader" for popular graphics image file formats.

fn load #

fn load(path string) ?Image

load load an image from a path

fn load_from_memory #

fn load_from_memory(buf &u8, bufsize int) ?Image

load_from_memory load an image from a memory buffer

fn set_flip_vertically_on_load #

fn set_flip_vertically_on_load(val bool)

fn set_flip_vertically_on_write #

fn set_flip_vertically_on_write(val bool)

fn set_png_compression_level #

fn set_png_compression_level(level int)

set_png_compression_level set the PNG compression level during the writing process defaults to 8; set to higher for more compression

fn stbi_write_bmp #

fn stbi_write_bmp(path string, w int, h int, comp int, buf &u8) ?

stbi_write_png write on path a BMP file

fn stbi_write_jpg #

fn stbi_write_jpg(path string, w int, h int, comp int, buf &u8, quality int) ?

stbi_write_png write on path a JPG file quality select the compression quality of the JPG quality is between 1 and 100. Higher quality looks better but results in a bigger image.

fn stbi_write_png #

fn stbi_write_png(path string, w int, h int, comp int, buf &u8, row_stride_in_bytes int) ?

stbi_write_png write on path a PNG file row_stride_in_bytes is usually equal to: w * comp

fn stbi_write_tga #

fn stbi_write_tga(path string, w int, h int, comp int, buf &u8) ?

stbi_write_png write on path a TGA file

fn write_force_png_filter #

fn write_force_png_filter(level int)

write_force_png_filter defaults to -1; set to 0..5 to force a filter mode the filter algorithms that can be applied before compression. The purpose of these filters is to prepare the image data for optimum compression.
Type Name

0 None 1 Sub 2 Up 3 Average 4 Paeth

fn write_tga_with_rle #

fn write_tga_with_rle(flag bool)

stbi_write_tga_with_rle enable/disable the TGA RLE during the writing process defaults to true; set to false to disable RLE in tga

struct Image #

struct Image {
pub mut:
	width       int
	height      int
	nr_channels int
	ok          bool
	data        voidptr
	ext         string
}

fn (Image) free #

fn (img &Image) free()