package core:image/jpeg
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.
Index
Variables (0)
This section is empty.
Procedures (6)
Types
Color_Space ¶
Color_Space :: image.JPEG_Color_Space
Entropy_Coding ¶
Entropy_Coding :: image.JPEG_Entropy_Coding
Error ¶
Error :: image.Error
Related Procedures With Returns
- load_from_bytes
- load_from_context
- load_from_file
- save_to_buffer
- save_to_file
- load (procedure groups)
- save (procedure groups)
Image ¶
Image :: image.Image
Related Procedures With Parameters
- destroy
- save_to_buffer
- save_to_file
- save (procedure groups)
Related Procedures With Returns
- load_from_bytes
- load_from_context
- load_from_file
- load (procedure groups)
Lossless_Predictor ¶
Lossless_Predictor :: image.JPEG_Lossless_Predictor
Options ¶
Options :: image.Options
Related Procedures With Parameters
- load_from_bytes
- load_from_context
- load_from_file
- save_to_buffer
- save_to_file
- load (procedure groups)
- save (procedure groups)
Profile ¶
Profile :: image.JPEG_Profile
Related Procedures With Parameters
- save_to_buffer
- save_to_file
- save (procedure groups)
Related Constants
Save_Options ¶
Save_Options :: image.JPEG_Save_Options
Related Procedures With Parameters
- save_to_buffer
- save_to_file
- save (procedure groups)
Subsampling ¶
Subsampling :: image.JPEG_Subsampling
Related Procedures With Parameters
- save_to_buffer
- save_to_file
- save (procedure groups)
Related Constants
Constants
BLOCK_SIZE ¶
BLOCK_SIZE :: 8
COEFFICIENT_COUNT ¶
COEFFICIENT_COUNT :: BLOCK_SIZE * BLOCK_SIZE
DEFAULT_PROFILE ¶
DEFAULT_PROFILE: image.JPEG_Profile : Profile.Baseline
DEFAULT_QUALITY ¶
DEFAULT_QUALITY :: 75
DEFAULT_SUBSAMPLING ¶
DEFAULT_SUBSAMPLING: image.JPEG_Subsampling : Subsampling.S420
MAX_COMPONENTS ¶
MAX_COMPONENTS :: 4
SEGMENT_MAX_SIZE ¶
SEGMENT_MAX_SIZE :: 65533
THUMBNAIL_PALETTE_SIZE ¶
THUMBNAIL_PALETTE_SIZE :: 768
Variables
This section is empty.
Procedures
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
load ¶
load :: proc{ load_from_file, load_from_bytes, load_from_context, }
save ¶
save :: proc{ save_to_buffer, save_to_file, }
Source Files
Generation Information
Generated with odin version dev-2026-11 (vendor "odin") Windows_amd64 @ 2026-11-18 21:05:19.828955300 +0000 UTC