package camlimages
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1c9a68bdc3d348c9f859d490dadf384926213e47a584159832f7fc4a20242865
md5=1ddba74d210b86a899b5d6565f45c2dc
doc/camlimages.jpeg/Jpeg/index.html
Module Jpeg
Source
1 JPEG markers
1 Basic save/load
Loads a jpeg image.
val load_thumbnail :
string ->
Images.load_option list ->
Geometry.spec ->
int * int * Images.t
JPEG image data is composed so that thumbnails of the size 1/2, 1/4 and 1/8 of the original size can be loaded faster. load_thumnail
loads an JPEG image with the one of these scales and 1/1 which is nearest and equal to or bigger than the given Gemetry.spec
.
Save a full-color image in jpeg format file. Raises Invalid_argument
if the image is not a full-color image.
val save_with_markers :
string ->
Images.save_option list ->
Images.t ->
Marker.t list ->
unit
Same as save
but it also writes markers
val save_as_cmyk :
string ->
Images.save_option list ->
(Images.rgb -> int * int * int * int) ->
Images.t ->
unit
Saves RGB24 image as a CMYK32 JPEG image, using the given color conversion function on the fly. More efficient than creating a CMYK24 image and saveing it.
Create CMYK jpeg image sample. Just for developpers.
Scanline based I/O functions
Scanline read handle
open_in path
opens a JPEG image path
and returns its width, height, a handle to get scanlines, and the JPEG makers.
val open_in_thumbnail :
string ->
Geometry.spec ->
int * int * (int * int * in_handle) * Marker.t list
open_in_thumbnail
is the same as open_in
but possibly scales down the image size based on the given Geometry.spec
int the same way as load_thumbnail
.
read_scanline h buf off
reads a scanline from the handle and store in bytes
at the offset off
. (image's width * bytes_per_pixel) bytes are overwritten from off
of bytes
. No size check of buf
is performed.
Scanline write handle
open_out path width height quality
opens a JPEG file at path
, with width
, height
and quality
. It returns a scanline handle for write.
write_marker h m
writes a maker to JPEG. It must be performed before calling write_scanline
.
write_scanline h buf
writes the contents of buf
to the write handle. buf
must have enough data for a scanline: (image's width * bytes_per_pixel) bytes of data must be available. No size check is performed.
Close the write handle
Accessing the header information without touching the pixel data
Checks the file header