package core:image/jpeg

⌘K
Ctrl+K
or
/

    Overview

    Reader and writer for JPEG images.

    Loading supports baseline, extended sequential and progressive encoding, as well as 12-bit DCT, lossless (SOF3), DNL and 2-component (gray + alpha) images, arithmetic coding (SOF9-11, DAC), and hierarchical mode (DHP, EXP, SOF5-7, SOF13-15), decoded at full resolution.

    Saving writes 8-bit baseline, extended sequential and progressive JPEG (standard or optimized Huffman tables, optional restart intervals), as greyscale, greyscale + alpha, YCbCr (4:4:4, 4:2:2 or 4:2:0), RGB, CMYK or YCCK, with a JFIF or Adobe header.

    16-bit input saves as 12-bit extended sequential or progressive JPEG. Lossless (SOF3) saving writes 8- or 16-bit greyscale, greyscale + alpha, RGB or CMYK, using any of the seven predictors or the best one per image. Arithmetic coding (SOF9-11, default conditioning) is available for all but baseline.

    Types

    Error ¶

    Error :: image.Error

    Related Procedures With Returns

    Image ¶

    Image :: image.Image

    Related Procedures With Parameters

    Related Procedures With Returns

    Options ¶

    Options :: image.Options

    Related Procedures With Parameters

    Profile ¶

    Profile :: image.JPEG_Profile

    Related Procedures With Parameters

    Related Constants

    Save_Options ¶

    Save_Options :: image.JPEG_Save_Options

    Related Procedures With Parameters

    Subsampling ¶

    Subsampling :: image.JPEG_Subsampling

    Related Procedures With Parameters

    Related Constants

    Constants

    COEFFICIENT_COUNT ¶

    COEFFICIENT_COUNT :: BLOCK_SIZE * BLOCK_SIZE

    DEFAULT_PROFILE ¶

    DEFAULT_PROFILE: image.JPEG_Profile : Profile.Baseline

    DEFAULT_SUBSAMPLING ¶

    DEFAULT_SUBSAMPLING: image.JPEG_Subsampling : Subsampling.S420

    Variables

    This section is empty.

    Procedures

    destroy ¶

    destroy :: proc(img: ^image.Image) {…}

    load_from_bytes ¶

    load_from_bytes :: proc(
    	data:      []u8, 
    	options:   image.Options = Options{}, 
    	allocator := context.allocator, 
    ) -> (img: ^image.Image, err: image.Error) {…}

    load_from_context ¶

    load_from_context :: proc(
    	ctx:       ^compress.Context, 
    	options:   image.Options = Options{}, 
    	allocator := context.allocator, 
    ) -> (img: ^image.Image, err: image.Error) {…}

    load_from_file ¶

    load_from_file :: proc(
    	filename:  string, 
    	options:   image.Options = Options{}, 
    	allocator := context.allocator, 
    ) -> (img: ^image.Image, err: image.Error) {…}

    save_to_buffer ¶

    save_to_buffer :: proc(
    	output:       ^[dynamic]u8, 
    	img:          ^image.Image, 
    	options:      image.Options = Options{}, 
    	quality:      int = DEFAULT_QUALITY, 
    	subsampling:  image.JPEG_Subsampling = DEFAULT_SUBSAMPLING, 
    	profile:      image.JPEG_Profile = DEFAULT_PROFILE, 
    	save_options: image.JPEG_Save_Options = Save_Options{}, 
    	allocator := context.allocator, 
    ) -> (err: image.Error) {…}

    save_to_file ¶

    save_to_file :: proc(
    	output:       string, 
    	img:          ^image.Image, 
    	options:      image.Options = Options{}, 
    	quality:      int = DEFAULT_QUALITY, 
    	subsampling:  image.JPEG_Subsampling = DEFAULT_SUBSAMPLING, 
    	profile:      image.JPEG_Profile = DEFAULT_PROFILE, 
    	save_options: image.JPEG_Save_Options = Save_Options{}, 
    	allocator := context.allocator, 
    ) -> (err: image.Error) {…}

    Procedure Groups

    Source Files

    Generation Information

    Generated with odin version dev-2026-11 (vendor "odin") Windows_amd64 @ 2026-11-18 21:05:19.828955300 +0000 UTC