GithubHelp home page GithubHelp logo

png-read's Introduction

Portable Network Graphics (PNG) decoder (more or less) for Common Lisp.

All critical chunks are implemented. Most ancillary chunks are. It should be able to read back any file produced by ZPNG. Interlaced files can be read, but without progressive loading.

Usage:

read-png-file (file) and read-png-datastream (stream), both return a png-state object and a boolean to indicate if CRC was successful, which most interesting property is image-data, a two (grayscale) or three dimensional array containing image data. Other properties are width, height, bit-depth and colour-type. If file was loaded by read-png-file slot png-file contains pathname used.

Dynamic variable *crc-fail-behaviour* can be set to one of :error, :warn or :no-action (default is :error), and controls what happens on checksum failure. Error signalled is of type png-read:crc-failure, and restart png-read:ignore-crc-failure is established.

For indexed images slot index-data contains an array with indices in palette (stored in palette slot), and image-data contains decoded colors.

The library loads all files from PNG Suite , but I did not check whether it does so correctly.

Note that ancillary chunks are mostly untested. They never modify primary image data array directly, but provide additional information in slots of png-state object. Of the ancillary chunks specified in specification missing are: cHRM, iCCP and sPLT. gAMA is present, but using it is responsibility of library user.

Dynamic variable *warn-missing-ancillaries* controls whether library warns on encountering unknown ancillary chunk.

Ancillary chunks:

  • tRNS - if present, additional alpha map is stored in slot transparency
  • gAMA - if present, image gamma is stored in slot gamma
  • sBIT - if present, the original number of significant bits is stored in slot significant-bits as a property list
  • sRGB - if present, rendering intent is stored in slot rendering-intent as a keyword symbol
  • tEXt - if present, text strings are collected in slot textual-data as an association list of keyword and string
  • zTXt - if present, text strings are collected in slot textual-data as an association list of keyword and string
  • iTXt - if present, text strings are collected in slot textual-data as an association list of keyword and a list of language tag, translated keyword and translated text
  • bKGD - if present, preferred background is stored in slot preferred-background as an array of color components (RGB), greyscale datum or palette index
  • hIST - if present, image histogram is stored in slot image-histogram as an array
  • pHYS - if present, intended pixel size is stored in slot physical-dimensions as a property list
  • tIME - if present, last modification time is stored in slot last-modification as an universal time

png-read's People

Contributors

ramarren avatar 3b avatar mfiano avatar akovalenko avatar slyrus avatar acieroid avatar deepfire avatar

Watchers

James Cloos 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.