arsd.jpeg

Loads a JPEG image from a memory buffer or a file.

req_comps can be 1 (grayscale), 3 (RGB), or 4 (RGBA). On return, width/height will be set to the image's dimensions, and actual_comps will be set to the either 1 (grayscale) or 3 (RGB). Requesting a 8 or 32bpp image is currently a little faster than 24bpp because the jpeg_decoder class itself currently always unpacks to either 8 or 32bpp.

Members

Aliases

JpegStreamReadFunc
alias JpegStreamReadFunc = int delegate(void* pBuf, int max_bytes_to_read, bool* pEOF_flag)

Input stream interface. This delegate is called when the internal input buffer is empty.

Enums

JpegSubsampling
enum JpegSubsampling

Writes a JPEG image to a file or stream. num_channels must be 1 (Y), 3 (RGB), 4 (RGBA), image pitch must be width*num_channels. note that alpha will not be stored in jpeg file.

Functions

compress_image_to_jpeg_file
bool compress_image_to_jpeg_file(const(char)[] fname, int width, int height, int num_channels, const(ubyte)[] pImage_data)

Writes JPEG image to file. num_channels must be 1 (Y), 3 (RGB), 4 (RGBA), image pitch must be width*num_channels. note that alpha will not be stored in jpeg file.

compress_image_to_jpeg_file
bool compress_image_to_jpeg_file(const(char)[] fname, int width, int height, int num_channels, const(ubyte)[] pImage_data, JpegParams comp_params)

Writes JPEG image to file. num_channels must be 1 (Y), 3 (RGB), 4 (RGBA), image pitch must be width*num_channels. note that alpha will not be stored in jpeg file.

compress_image_to_jpeg_stream
bool compress_image_to_jpeg_stream(jpeg_encoder.WriteFunc wfn, int width, int height, int num_channels, const(ubyte)[] pImage_data)

Writes JPEG image to file. num_channels must be 1 (Y), 3 (RGB), 4 (RGBA), image pitch must be width*num_channels. note that alpha will not be stored in jpeg file.

compress_image_to_jpeg_stream
bool compress_image_to_jpeg_stream(jpeg_encoder.WriteFunc wfn, int width, int height, int num_channels, const(ubyte)[] pImage_data, JpegParams comp_params)

Writes JPEG image to file. num_channels must be 1 (Y), 3 (RGB), 4 (RGBA), image pitch must be width*num_channels. note that alpha will not be stored in jpeg file.

decompress_jpeg_image_from_file
ubyte[] decompress_jpeg_image_from_file(const(char)[] filename, int width, int height, int actual_comps, int req_comps)

decompress JPEG image from disk file. you can specify required color components in req_comps (3 for RGB or 4 for RGBA), or leave it as is to use image value.

decompress_jpeg_image_from_file
ubyte[] decompress_jpeg_image_from_file(VFile fl, int width, int height, int actual_comps, int req_comps)

decompress JPEG image from disk file. you can specify required color components in req_comps (3 for RGB or 4 for RGBA), or leave it as is to use image value.

decompress_jpeg_image_from_memory
ubyte[] decompress_jpeg_image_from_memory(const(void)[] buf, int width, int height, int actual_comps, int req_comps)

decompress JPEG image from memory buffer. you can specify required color components in req_comps (3 for RGB or 4 for RGBA), or leave it as is to use image value.

decompress_jpeg_image_from_stream
ubyte[] decompress_jpeg_image_from_stream(JpegStreamReadFunc rfn, int width, int height, int actual_comps, int req_comps)

decompress JPEG image, what else? you can specify required color components in req_comps (3 for RGB or 4 for RGBA), or leave it as is to use image value.

detect_jpeg_image_from_file
bool detect_jpeg_image_from_file(const(char)[] filename, int width, int height, int actual_comps)

read JPEG image header, determine dimensions and number of components. return false if image is not JPEG (i hope).

detect_jpeg_image_from_memory
bool detect_jpeg_image_from_memory(const(void)[] buf, int width, int height, int actual_comps)

read JPEG image header, determine dimensions and number of components. return false if image is not JPEG (i hope).

detect_jpeg_image_from_stream
bool detect_jpeg_image_from_stream(JpegStreamReadFunc rfn, int width, int height, int actual_comps)

read JPEG image header, determine dimensions and number of components. return false if image is not JPEG (i hope).

encodeJpeg
ubyte[] encodeJpeg(TrueColorImage img, JpegParams params)
void encodeJpeg(bool delegate(const scope ubyte[]) dg, TrueColorImage img, JpegParams params)

Encodes an image as jpeg in memory.

readJpeg
MemoryImage readJpeg(const(char)[] filename)

decompress JPEG image from disk file. Returns null if loading failed for any reason.

readJpegFromMemory
MemoryImage readJpegFromMemory(const(void)[] buf)

decompress JPEG image from memory buffer.

readJpegFromStream
MemoryImage readJpegFromStream(JpegStreamReadFunc rfn)

decompress JPEG image, what else?

writeJpeg
void writeJpeg(const(char)[] filename, TrueColorImage img, JpegParams params)

Structs

JpegParams
struct JpegParams

JPEG compression parameters structure.

Meta