The jpeg-turbo Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The jpeg-turbo Reference Manual

This is the jpeg-turbo Reference Manual, version 1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 04:52:53 2022 GMT+0.

Table of Contents


1 Introduction

jpeg-turbo

Build Status CI

jpeg-turbo is a Common Lisp wrapper for libjpeg-turbo library which provides TurboJPEG API for compressing and decompressing JPEG images. To build this wrapper make sure that both libjpeg-turbo library and headers are installed (on FreeBSD this is done by installing graphics/libjpeg-turbo port).

Examples

Read header of an image (get width, height, subsampling mode and colorspace):

(with-decompressor (handle)
    (decompress-header handle "example.jpg"))

Decode a whole image, converting it to grayscale:

(with-decompressor (handle)
    (decompress handle "example.jpg"
                :pixel-format :gray))

Encode an image contained in array. Each pixel is encoded in three elements of the array. These elements must be red, green and blue components of the pixel.

(with-compressor (handle)
    (compress handle "example.jpg" array
              width height :rgb))

Documentation

Visit the project page. If you want a local copy, run (codex:document :jpeg-turbo :skip-undocumented t).

TODO

Add transformation API


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 jpeg-turbo

libjpeg-turbo wrapper for Common Lisp

Maintainer

Vasily Postnicov <shamaz.mazum@gmail.com>

Author

Vasily Postnicov <shamaz.mazum@gmail.com>

License

2-clause BSD

Version

1.0

Defsystem Dependency

cffi-grovel (system).

Dependency

cffi (system).

Source

jpeg-turbo.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 jpeg-turbo/jpeg-turbo.asd

Source

jpeg-turbo.asd.

Parent Component

jpeg-turbo (system).

ASDF Systems

jpeg-turbo.


3.1.2 jpeg-turbo/src/package.lisp

Source

jpeg-turbo.asd.

Parent Component

jpeg-turbo (system).

Packages

jpeg-turbo.


3.1.3 jpeg-turbo/src/grovel.lisp

Dependency

src/package.lisp (file).

Source

jpeg-turbo.asd.

Parent Component

jpeg-turbo (system).


3.1.4 jpeg-turbo/src/jpeg-turbo.lisp

Dependency

src/grovel.lisp (file).

Source

jpeg-turbo.asd.

Parent Component

jpeg-turbo (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 jpeg-turbo

Source

src/package.lisp.

Use List
  • cffi.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: with-compressor ((handle) &body body)

Execute the macro’s body in the lexical scope of created compressor handle @c(handle). The handle is safely freed after use.

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Macro: with-decompressor ((handle) &body body)

Execute the macro’s body in the lexical scope of created decompressor handle @c(handle). The handle is safely freed after use.

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.


Next: , Previous: , Up: Public Interface   [Contents][Index]

5.1.2 Ordinary functions

Function: compress (handle filename array width height pixel-format &key quality subsamp flags)

Compress an image to jpeg format and write it to file with the name @c(filename). See @c(compress-to-octets) for more info.

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: compress-to-octets (handle array width height pixel-format &key quality subsamp flags)

Compress an image to jpeg format. @c(handle) is a compressor handle created with @c(with-compressor). @c(array) is a simple array of @c((unsigned-byte 8)) values containing pixel data. Values of @c(pixel-format) described in section @ref[id=pf](pixel
formats). @c(quality) is an integer from 1 to 100. Higher values mean better quality. @c(subsamp) is described in @ref[id=subsamp](subsampling) section and @c(flags) in @ref[id=flags](flags) section.

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: decompress (handle filename &key scaling-factor pixel-format flags)

Decompress an image directly from file with the name @c(filename). See @c(decompress-from-octets) for more info

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: decompress-from-octets (handle array &key scaling-factor pixel-format flags)

Decompress a jpeg image. @c(handle) is a decompressor handle created with @c(with-decompressor). @c(array) is a simple array of @c((unsigned-byte 8)) values containing a compressed image. If @c(pixel-format) is specified, @c(libjpeg-turbo) converts output pixel format to a specified value. For the values of @c(pixel-format) see the section @ref[id=pf](pixel formats). For more information about @c(flags) see the section @ref[id=flags](flags). If @c(scaling-factor) is specified @c(librurbo-jpeg) will scale the output image to this scaling factor. Possible values are returned by @c(scaling-factors).

Return a decompressed image as a simple-array of @c((unsigned-byte 8)) value in the same manner as @c(cl-jpeg) does.

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: decompress-header (handle filename)

This is function is like @c(decompress-header-from-octets) but reads compressed image directly from file with the name @c(filename).

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: decompress-header-from-octets (handle array)

Decompress header of an image. @c(handle) must be a handle to decompressor created with @c(with-decompressor). @c(array) must be a simple array of @c((unsigned-byte 8)) values containing compressed jpeg image. Function returns four values:
@begin(enum)
@item(Width of an image.)
@item(Height of an image.)
@item(Chroma subsampling. See @ref[id=subsamp](subsampling) section.) @item(Colorspace. See @ref[id=cs](colorspaces) section.) @end(enum)

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: scaling-factors ()

Return scaling factors supported by @c(libjpeg-turbo)

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.


5.1.3 Conditions

Condition: jpeg-error

Errors returned by libjpeg-turbo

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Direct superclasses

error.

Direct methods

jpeg-error-string.

Direct slots
Slot: error-string
Initargs

:error-string

Readers

jpeg-error-string.

Writers

This slot is read-only.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *pixel-sizes*

Size of a pixel in bytes for each pixel format

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.


5.2.2 Ordinary functions

Function: buf-size% (width height subsamp)
Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: destroy-handle% (handle)
Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: init-compress% ()

Initialize jpeg compressor returning a handle to it. The handle must be freed with @c(destroy-handle%) after use. Use @c(with-compressor) macro instead of this function.

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: init-decompress% ()

Initialize decompressor handle or signal an error. The handle must be destroyed after use with @c(destroy-handle%). It’s preferred to use @c(with-decompressor) macro which safely destroys the handle in the case of an error instead of this function.

Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: last-error (handle)
Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: pixel-size (pixel-format)
Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Function: scale (x scaling)
Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.3 Generic functions

Generic Reader: jpeg-error-string (condition)
Package

jpeg-turbo.

Methods
Reader Method: jpeg-error-string ((condition jpeg-error))
Source

src/jpeg-turbo.lisp.

Target Slot

error-string.


Previous: , Up: Internals   [Contents][Index]

5.2.4 Classes

Class: scaling-factor-tclass
Package

jpeg-turbo.

Source

src/jpeg-turbo.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   B   C   D   F   G   I   J   L   M   P   S   W  
Index Entry  Section

B
buf-size%: Private ordinary functions

C
compress: Public ordinary functions
compress-to-octets: Public ordinary functions

D
decompress: Public ordinary functions
decompress-from-octets: Public ordinary functions
decompress-header: Public ordinary functions
decompress-header-from-octets: Public ordinary functions
destroy-handle%: Private ordinary functions

F
Function, buf-size%: Private ordinary functions
Function, compress: Public ordinary functions
Function, compress-to-octets: Public ordinary functions
Function, decompress: Public ordinary functions
Function, decompress-from-octets: Public ordinary functions
Function, decompress-header: Public ordinary functions
Function, decompress-header-from-octets: Public ordinary functions
Function, destroy-handle%: Private ordinary functions
Function, init-compress%: Private ordinary functions
Function, init-decompress%: Private ordinary functions
Function, last-error: Private ordinary functions
Function, pixel-size: Private ordinary functions
Function, scale: Private ordinary functions
Function, scaling-factors: Public ordinary functions

G
Generic Function, jpeg-error-string: Private generic functions

I
init-compress%: Private ordinary functions
init-decompress%: Private ordinary functions

J
jpeg-error-string: Private generic functions
jpeg-error-string: Private generic functions

L
last-error: Private ordinary functions

M
Macro, with-compressor: Public macros
Macro, with-decompressor: Public macros
Method, jpeg-error-string: Private generic functions

P
pixel-size: Private ordinary functions

S
scale: Private ordinary functions
scaling-factors: Public ordinary functions

W
with-compressor: Public macros
with-decompressor: Public macros

Jump to:   B   C   D   F   G   I   J   L   M   P   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
E   S  
Index Entry  Section

*
*pixel-sizes*: Private special variables

E
error-string: Public conditions

S
Slot, error-string: Public conditions
Special Variable, *pixel-sizes*: Private special variables

Jump to:   *  
E   S