package vendor:stb/image

⌘K
Ctrl+K
or
/

    Overview

    Bindings for stb_image.h.

    Index

    Variables (0)

    This section is empty.

    Procedures (63)
    Procedure Groups (0)

    This section is empty.

    Types

    Io_Callbacks ¶

    Io_Callbacks :: struct {
    	read: proc "c" (user: rawptr, data: [^]u8, size: i32) -> i32,
    	// fill 'data' with 'size' u8s.  return number of u8s actually read
    	skip: proc "c" (user: rawptr, n: i32),
    	// skip the next 'n' u8s, or 'unget' the last -n u8s if negative
    	eof:  proc "c" (user: rawptr) -> i32,
    }
     

    load image by filename, open file, or memory buffer

    Related Procedures With Parameters

    colorspace ¶

    colorspace :: enum i32 {
    	LINEAR, 
    	SRGB, 
    	MAX_COLORSPACES, 
    }

    Related Procedures With Parameters

    datatype ¶

    datatype :: enum i32 {
    	UINT8, 
    	UINT16, 
    	UINT32, 
    	FLOAT, 
    	MAX_TYPES, 
    }

    Related Procedures With Parameters

    filter ¶

    filter :: enum i32 {
    	DEFAULT      = 0, // use same filter type that easy-to-use API chooses
    	BOX          = 1, // A trapezoid w/1-pixel wide ramps, same result as box for integer scale ratios
    	TRIANGLE     = 2, // On upsampling, produces same results as bilinear texture filtering
    	CUBICBSPLINE = 3, // The cubic b-spline (aka Mitchell-Netrevalli with B=1,C=0), gaussian-esque
    	CATMULLROM   = 4, // An interpolating cubic spline
    	MITCHELL     = 5, // Mitchell-Netrevalli filter with B=1/3, C=1/3
    }

    Related Procedures With Parameters

    Constants

    FLAG_ALPHA_PREMULTIPLIED ¶

    FLAG_ALPHA_PREMULTIPLIED :: 1 << 0
     

    Set this flag if your texture has premultiplied alpha. Otherwise, stbir will use alpha-weighted resampling (effectively premultiplying, resampling, then unpremultiplying).

    FLAG_ALPHA_USES_COLORSPACE ¶

    FLAG_ALPHA_USES_COLORSPACE :: 1 << 1
     

    The specified alpha channel should be handled as gamma-corrected value even when doing sRGB operations.

    NO_STDIO ¶

    NO_STDIO :: ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32

    Variables

    This section is empty.

    Procedures

    convert_iphone_png_to_rgb ¶
    C · stbi_convert_iphone_png_to_rgbSource · stb_image.odin:130

    convert_iphone_png_to_rgb :: proc "c" (flag_true_if_should_convert: i32) ---
     

    indicate whether we should process iphone images back to canonical format, or just pass them through "as-is"

    convert_iphone_png_to_rgb_thread ¶
    C · stbi_convert_iphone_png_to_rgb_threadSource · stb_image.odin:139

    convert_iphone_png_to_rgb_thread :: proc "c" (flag_true_if_should_convert: b32) ---

    failure_reason ¶
    C · stbi_failure_reasonSource · stb_image.odin:112

    failure_reason :: proc "c" () -> cstring ---
     

    get a VERY brief reason for failure NOT THREADSAFE

    flip_vertically_on_write ¶
    C · stbi_flip_vertically_on_writeSource · stb_image_write.odin:35

    flip_vertically_on_write :: proc "c" (flip_boolean: b32) ---

    hdr_to_ldr_gamma ¶
    C · stbi_hdr_to_ldr_gammaSource · stb_image.odin:101

    hdr_to_ldr_gamma :: proc "c" (gamma: f32) ---

    hdr_to_ldr_scale ¶
    C · stbi_hdr_to_ldr_scaleSource · stb_image.odin:102

    hdr_to_ldr_scale :: proc "c" (scale: f32) ---

    image_free ¶
    C · stbi_image_freeSource · stb_image.odin:115

    image_free :: proc "c" (retval_from_load: rawptr) ---
     

    free the loaded image -- this is just free()

    info ¶

    info :: proc "c" (filename: cstring, x, y, comp: ^i32) -> i32 ---
     

    get image dimensions & components without fully decoding

    info_from_callbacks ¶
    C · stbi_info_from_callbacksSource · stb_image.odin:119

    info_from_callbacks :: proc "c" (clbk: ^Io_Callbacks, user: rawptr, x, y, comp: ^i32) -> i32 ---

    info_from_file ¶
    C · stbi_info_from_fileSource · stb_image.odin:69

    info_from_file :: proc "c" (f: ^c.FILE, x, y, comp: ^i32) -> i32 ---

    info_from_memory ¶
    C · stbi_info_from_memorySource · stb_image.odin:118

    info_from_memory :: proc "c" (buffer: [^]u8, len: i32, x, y, comp: ^i32) -> i32 ---
     

    get image dimensions & components without fully decoding

    is_16_bit ¶
    C · stbi_is_16_bitSource · stb_image.odin:71

    is_16_bit :: proc "c" (filename: cstring) -> b32 ---

    is_16_bit_from_file ¶
    C · stbi_is_16_bit_from_fileSource · stb_image.odin:72

    is_16_bit_from_file :: proc "c" (f: ^c.FILE) -> b32 ---

    is_16_bit_from_memory ¶
    C · stbi_is_16_bit_from_memorySource · stb_image.odin:121

    is_16_bit_from_memory :: proc "c" (buffer: [^]u8, len: i32) -> i32 ---

    is_hdr ¶

    is_hdr :: proc "c" (filename: cstring) -> i32 ---

    is_hdr_from_callbacks ¶
    C · stbi_is_hdr_from_callbacksSource · stb_image.odin:107

    is_hdr_from_callbacks :: proc "c" (clbk: ^Io_Callbacks, user: rawptr) -> i32 ---

    is_hdr_from_file ¶
    C · stbi_is_hdr_from_fileSource · stb_image.odin:65

    is_hdr_from_file :: proc "c" (f: ^c.FILE) -> i32 ---

    is_hdr_from_memory ¶
    C · stbi_is_hdr_from_memorySource · stb_image.odin:108

    is_hdr_from_memory :: proc "c" (buffer: [^]u8, len: i32) -> i32 ---

    ldr_to_hdr_gamma ¶
    C · stbi_ldr_to_hdr_gammaSource · stb_image.odin:104

    ldr_to_hdr_gamma :: proc "c" (gamma: f32) ---

    ldr_to_hdr_scale ¶
    C · stbi_ldr_to_hdr_scaleSource · stb_image.odin:105

    ldr_to_hdr_scale :: proc "c" (scale: f32) ---

    load ¶

    load :: proc "c" (
    	filename:               cstring, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u8 ---
     

    //////////////////////////////////

    8-bits-per-channel interface

    load_16 ¶

    load_16 :: proc "c" (
    	filename:               cstring, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u16 ---
     

    //////////////////////////////////

    16-bits-per-channel interface

    load_16_from_callbacks ¶
    C · stbi_load_16_from_callbacksSource · stb_image.odin:92

    load_16_from_callbacks :: proc "c" (
    	clbk:                   ^Io_Callbacks, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u16 ---

    load_16_from_file ¶
    C · stbi_load_16_from_fileSource · stb_image.odin:55

    load_16_from_file :: proc "c" (
    	f:                      ^c.FILE, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u16 ---

    load_16_from_memory ¶
    C · stbi_load_16_from_memorySource · stb_image.odin:91

    load_16_from_memory :: proc "c" (
    	buffer:                 [^]u8, 
    	len:                    i32, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u16 ---
     

    //////////////////////////////////

    16-bits-per-channel interface

    load_from_callbacks ¶
    C · stbi_load_from_callbacksSource · stb_image.odin:83

    load_from_callbacks :: proc "c" (
    	clbk:                   ^Io_Callbacks, 
    	user:                   rawptr, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u8 ---

    load_from_file ¶
    C · stbi_load_from_fileSource · stb_image.odin:48

    load_from_file :: proc "c" (
    	f:                      ^c.FILE, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u8 ---

    load_from_memory ¶
    C · stbi_load_from_memorySource · stb_image.odin:82

    load_from_memory :: proc "c" (
    	buffer:                 [^]u8, 
    	len:                    i32, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]u8 ---
     

    //////////////////////////////////

    8-bits-per-channel interface

    load_gif_from_memory ¶
    C · stbi_load_gif_from_memorySource · stb_image.odin:85

    load_gif_from_memory :: proc "c" (
    	buffer:        [^]u8, 
    	len:           i32, 
    	delays:        ^[^]i32, 
    	x, y, z, comp: ^i32, 
    	req_comp:      i32, 
    ) -> [^]u8 ---

    loadf ¶

    loadf :: proc "c" (
    	filename:               cstring, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]f32 ---
     

    //////////////////////////////////

    float-per-channel interface

    loadf_from_callbacks ¶
    C · stbi_loadf_from_callbacksSource · stb_image.odin:99

    loadf_from_callbacks :: proc "c" (
    	clbk:                   ^Io_Callbacks, 
    	user:                   rawptr, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]f32 ---

    loadf_from_file ¶
    C · stbi_loadf_from_fileSource · stb_image.odin:62

    loadf_from_file :: proc "c" (
    	f:                      ^c.FILE, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]f32 ---

    loadf_from_memory ¶
    C · stbi_loadf_from_memorySource · stb_image.odin:98

    loadf_from_memory :: proc "c" (
    	buffer:                 [^]u8, 
    	len:                    i32, 
    	x, y, channels_in_file: ^i32, 
    	desired_channels:       i32, 
    ) -> [^]f32 ---
     

    //////////////////////////////////

    float-per-channel interface

    resize ¶

    resize :: proc "c" (
    	input_pixels:                               rawptr, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              rawptr, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	datatype:                                   datatype, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    	edge_mode_horizontal, edge_mode_vertical:   edge, 
    	filter_horizontal, filter_vertical:         filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_float ¶
    C · stbir_resize_floatSource · stb_image_resize.odin:49

    resize_float :: proc "c" (
    	input_pixels:                               [^]f32, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              [^]f32, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	num_channels:                               i32, 
    ) -> i32 ---

    resize_float_generic ¶
    C · stbir_resize_float_genericSource · stb_image_resize.odin:142

    resize_float_generic :: proc "c" (
    	input_pixels:                               [^]f32, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              [^]f32, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    	edge_wrap_mode:                             edge, 
    	filter:                                     filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_region ¶
    C · stbir_resize_regionSource · stb_image_resize.odin:195

    resize_region :: proc "c" (
    	input_pixels:                               rawptr, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              rawptr, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	datatype:                                   datatype, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    	edge_mode_horizontal, edge_mode_vertical:   edge, 
    	filter_horizontal, filter_vertical:         filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    	s0, t0, s1, 
    	t1:                                         f32, 
    ) -> i32 ---

    resize_subpixel ¶
    C · stbir_resize_subpixelSource · stb_image_resize.odin:185

    resize_subpixel :: proc "c" (
    	input_pixels:                               rawptr, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              rawptr, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	datatype:                                   datatype, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    	edge_mode_horizontal, edge_mode_vertical:   edge, 
    	filter_horizontal, filter_vertical:         filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    	x_scale, y_scale:                           f32, 
    	x_offset, 
    	y_offset:                                   f32, 
    ) -> i32 ---

    resize_uint16_generic ¶
    C · stbir_resize_uint16_genericSource · stb_image_resize.odin:136

    resize_uint16_generic :: proc "c" (
    	input_pixels:                               [^]u16, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              [^]u16, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    	edge_wrap_mode:                             edge, 
    	filter:                                     filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_uint8 ¶
    C · stbir_resize_uint8Source · stb_image_resize.odin:45

    resize_uint8 :: proc "c" (
    	input_pixels:                               [^]u8, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              [^]u8, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	num_channels:                               i32, 
    ) -> i32 ---

    resize_uint8_generic ¶
    C · stbir_resize_uint8_genericSource · stb_image_resize.odin:130

    resize_uint8_generic :: proc "c" (
    	input_pixels:                               [^]u8, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              [^]u8, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    	edge_wrap_mode:                             edge, 
    	filter:                                     filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_uint8_srgb ¶
    C · stbir_resize_uint8_srgbSource · stb_image_resize.odin:80

    resize_uint8_srgb :: proc "c" (
    	input_pixels:                               [^]u8, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              [^]u8, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    ) -> i32 ---

    resize_uint8_srgb_edgemode ¶
    C · stbir_resize_uint8_srgb_edgemodeSource · stb_image_resize.odin:86

    resize_uint8_srgb_edgemode :: proc "c" (
    	input_pixels:                               [^]u8, 
    	input_w, input_h, input_stride_in_bytes:    i32, 
    	output_pixels:                              [^]u8, 
    	output_w, output_h, output_stride_in_bytes: i32, 
    	num_channels:                               i32, 
    	alpha_channel:                              i32, 
    	flags:                                      i32, 
    	edge_wrap_mode:                             edge, 
    ) -> i32 ---
     

    This function adds the ability to specify how requests to sample off the edge of the image are handled.

    set_flip_vertically_on_load ¶
    C · stbi_set_flip_vertically_on_loadSource · stb_image.odin:133

    set_flip_vertically_on_load :: proc "c" (flag_true_if_should_flip: i32) ---
     

    flip the image vertically, so the first pixel in the output array is the bottom left

    set_flip_vertically_on_load_thread ¶
    C · stbi_set_flip_vertically_on_load_threadSource · stb_image.odin:140

    set_flip_vertically_on_load_thread :: proc "c" (flag_true_if_should_flip: b32) ---

    set_unpremultiply_on_load ¶
    C · stbi_set_unpremultiply_on_loadSource · stb_image.odin:126

    set_unpremultiply_on_load :: proc "c" (flag_true_if_should_unpremultiply: i32) ---
     

    for image formats that explicitly notate that they have premultiplied alpha, we just return the colors as stored in the file. set this flag to force unpremultiplication. results are undefined if the unpremultiply overflow.

    set_unpremultiply_on_load_thread ¶
    C · stbi_set_unpremultiply_on_load_threadSource · stb_image.odin:138

    set_unpremultiply_on_load_thread :: proc "c" (flag_true_if_should_unpremultiply: b32) ---
     

    as above, but only applies to images loaded on the thread that calls the function this function is only available if your compiler supports thread-local variables; calling it will fail to link if your compiler doesn't

    write_bmp ¶

    write_bmp :: proc "c" (filename: cstring, w, h, comp: i32, data: rawptr) -> i32 ---

    write_bmp_to_func ¶
    C · stbi_write_bmp_to_funcSource · stb_image_write.odin:30

    write_bmp_to_func :: proc "c" (
    	func:       write_func, 
    	ctx:        rawptr, 
    	w, h, comp: i32, 
    	data:       rawptr, 
    ) -> i32 ---

    write_hdr ¶

    write_hdr :: proc "c" (filename: cstring, w, h, comp: i32, data: [^]f32) -> i32 ---

    write_hdr_to_func ¶
    C · stbi_write_hdr_to_funcSource · stb_image_write.odin:32

    write_hdr_to_func :: proc "c" (
    	func:       write_func, 
    	ctx:        rawptr, 
    	w, h, comp: i32, 
    	data:       [^]f32, 
    ) -> i32 ---

    write_jpg ¶

    write_jpg :: proc "c" (
    	filename:   cstring, 
    	w, h, comp: i32, 
    	data:       rawptr, 
    	quality:    i32, 
    ) -> i32 ---

    write_jpg_to_func ¶
    C · stbi_write_jpg_to_funcSource · stb_image_write.odin:33

    write_jpg_to_func :: proc "c" (
    	func:       write_func, 
    	ctx:        rawptr, 
    	x, y, comp: i32, 
    	data:       rawptr, 
    	quality:    i32, 
    ) -> i32 ---

    write_png ¶

    write_png :: proc "c" (
    	filename:        cstring, 
    	w, h, comp:      i32, 
    	data:            rawptr, 
    	stride_in_bytes: i32, 
    ) -> i32 ---

    write_png_to_func ¶
    C · stbi_write_png_to_funcSource · stb_image_write.odin:29

    write_png_to_func :: proc "c" (
    	func:            write_func, 
    	ctx:             rawptr, 
    	w, h, comp:      i32, 
    	data:            rawptr, 
    	stride_in_bytes: i32, 
    ) -> i32 ---

    write_tga ¶

    write_tga :: proc "c" (filename: cstring, w, h, comp: i32, data: rawptr) -> i32 ---

    write_tga_to_func ¶
    C · stbi_write_tga_to_funcSource · stb_image_write.odin:31

    write_tga_to_func :: proc "c" (
    	func:       write_func, 
    	ctx:        rawptr, 
    	w, h, comp: i32, 
    	data:       rawptr, 
    ) -> i32 ---

    zlib_decode_buffer ¶
    C · stbi_zlib_decode_bufferSource · stb_image.odin:146

    zlib_decode_buffer :: proc "c" (obuffer: [^]u8, olen: i32, ibuffer: [^]u8, ilen: i32) -> i32 ---

    zlib_decode_malloc ¶
    C · stbi_zlib_decode_mallocSource · stb_image.odin:145

    zlib_decode_malloc :: proc "c" (buffer: [^]u8, len: i32, outlen: ^i32) -> [^]u8 ---

    zlib_decode_malloc_guesssize ¶
    C · stbi_zlib_decode_malloc_guesssizeSource · stb_image.odin:143

    zlib_decode_malloc_guesssize :: proc "c" (
    	buffer:       [^]u8, 
    	len:          i32, 
    	initial_size: i32, 
    	outlen:       ^i32, 
    ) -> [^]u8 ---
     

    ZLIB client - used by PNG, available for other purposes

    zlib_decode_malloc_guesssize_headerflag ¶
    C · stbi_zlib_decode_malloc_guesssize_headerflagSource · stb_image.odin:144

    zlib_decode_malloc_guesssize_headerflag :: proc "c" (
    	buffer:       [^]u8, 
    	len:          i32, 
    	initial_size: i32, 
    	outlen:       ^i32, 
    	parse_header: b32, 
    ) -> [^]u8 ---

    zlib_decode_noheader_buffer ¶
    C · stbi_zlib_decode_noheader_bufferSource · stb_image.odin:149

    zlib_decode_noheader_buffer :: proc "c" (
    	obuffer: [^]u8, 
    	olen:    i32, 
    	ibuffer: [^]u8, 
    	ilen:    i32, 
    ) -> i32 ---

    zlib_decode_noheader_malloc ¶
    C · stbi_zlib_decode_noheader_mallocSource · stb_image.odin:148

    zlib_decode_noheader_malloc :: proc "c" (buffer: [^]u8, len: i32, outlen: ^i32) -> [^]u8 ---

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-12 23:22:57.846843600 +0000 UTC