GithubHelp home page GithubHelp logo

varjagg / cl-jpeg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sharplispers/cl-jpeg

1.0 4.0 0.0 205 KB

git mirror of Eugene Zaikonnikov's cl-jpeg JPEG library for common lisp

Home Page: http://common-lisp.net/project/cl-jpeg/

License: Other

Common Lisp 100.00%
jpeg codec common-lisp

cl-jpeg's Introduction

Build Status

CL-JPEG

Baseline JPEG codec written in Common Lisp. Up-to-date source is hosted on GitHub.

Written by Eugene Zaikonnikov, 1999-2017. Valuable contributors, in no particular order: Henry Harrington, Kenan Bölükbaşı, Manuel Giraud, Cyrus Harmon and William Halliburton.

Image Format

  • B, G, R pixels in case of colorspace-converted three component image
  • Y, Cb, Cr pixels in case where colorspace conversion of three component image was disabled
  • array of grayscale pixels in case of single component
  • array of 2 or 4 pixels in the case of two or four component image respectively

Decoding

(DECODE-IMAGE FILENAME &KEY BUFFER (COLORSPACE-CONVERSION T) CACHED-SOURCE-P)

  • FILENAME - jpeg file name
  • BUFFER - optional reusable storage for output image
  • COLORSPACE-CONVERSION controls if YUV to RGB should be performed
  • CACHED-SOURCE-P - the file input layer behaviour

Returns (multiple-valued) decoded IMAGE array in the same format as encoder source image, image HEIGHT and image WIDTH.

(DECODE-STREAM STREAM &KEY BUFFER (COLORSPACE-CONVERSION T) DESCRIPTOR CACHED-SOURCE-P)

  • STREAM - jpeg image stream or NIL in case where the buffer is pre-allocated in DESCRIPTOR
  • BUFFER - optional reusable storage for output image
  • COLORSPACE-CONVERSION controls if YUV to RGB should be performed
  • DESCRIPTOR is a JPEG:DESCRIPTOR structure. Can be reused for performance reasons bulk processing applications
  • CACHED-SOURCE-P - the file input layer behaviour

Returns (multiple-valued) decoded IMAGE array in the same format as encoder source image, image HEIGHT and image WIDTH.

(ALLOCATE-BUFFER HEIGHT WIDTH NCOMP)

  • HEIGHT - image height
  • WIDTH - image width
  • NCOMP - number of image components

Allocates and retruns a buffer suitable for storage of the output image in the specified geometry.

(JPEG-FILE-DIMENSIONS FILENAME)

  • FILENAME - the file to be probed

Returns image height, width, number of components, and the type of Adobe colorpsace transform encoded in the image (:YCBCR-RGB, :YCCK-CMYK).

(CONVERT-CMYK-TO-RGB BUFFER H W &key RGB-BUFFER)

  • BUFFER - the input CMYK pixel buffer
  • H,W - image dimensions
  • RGB-BUFFER - optional reusable storage for output RGB image

Returns an RGB conversion of the supplied CMYK image.

###(JPEG-TO-BMP &key INFILE OUTFILE)

Converts JPEG file to BMP file.

Encoding

(ENCODE-IMAGE FILENAME IMAGE NCOMP H W &key SAMPLING Q-TABS Q-FACTOR)

  • FILENAME - output file name
  • IMAGE - input array of pixels
  • NCOMP - number of components in the image
  • H, W - image dimensions
  • SAMPLING - sampling frequency for ncomp components by X and Y axis, e.g. '((2 2) (1 1) (1 1)) for three components, can be omitted for grayscale and RGB images
  • Q-TABS - specifies quantization tables vector, should be 1 for 1, 2 for 2, 2 for 3 and 4 entries for 4 components
  • Q-FACTOR - quality specifier (1-64), default is 64

Encodes the supplied image using the sampling specifier, quantization tables and quantization factor.

(ENCODING-WRAPPER FILENAME IMAGE NCOMP H W &key (QUALITY 4))

  • FILENAME - output file name
  • IMAGE - input array of pixels
  • NCOMP - number of components in the image
  • H, W - image dimensions
  • QUALITY - quality factor on scale from 1 to 5

TODO

  • Add progressive JPEG support in decoder

cl-jpeg's People

Contributors

froggey avatar mgi avatar slyrus avatar varjagg avatar whalliburton avatar xach avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.