GithubHelp home page GithubHelp logo

lgpng's Introduction

lgpng

The lgpng library allows to explore the PNG file format. It is not (for now) intended to actually decode the pixels to display an image.

Some utilities using lgpng are provided in this repository.

Contents

  1. Install
  2. pnginfo
  3. pngdump
  4. License

Install

Requires

  • C compiler ;
  • zlib.

Build

$ ./configure
$ make
# make install

Alternatively install in your $HOME/bin:

$ ./configure PREFIX=~/
$ make
$ make install

Tests

A few regression tests are available when invoking the command:

$ make regress

pnginfo

It is possible to list the chunks in a given PNG file or to request the details of a specific chunk.

Examples:

$ pnginfo -f lena.png -l
IHDR
sRGB
IDAT
IEND
$ pnginfo -f lena.png -c IHDR
IHDR: width: 512
IHDR: height: 512
IHDR: bitdepth: 8
IHDR: colourtype: truecolour
IHDR: compression: deflate
IHDR: filter: adaptive
IHDR: interlace method: standard
$ cat lena.ong | pnginfo -c sRGB
sRGB: rendering intent: perceptual

Here is a list of supported chunks:

  • PNG specification (Third edition):
    • IHDR
    • PLTE
    • IDAT
    • IDEN
    • tRNS
    • cHRM
    • gAMA
    • iCCP
    • sBIT
    • sRGB
    • cICP
    • tEXt
    • zTXt
    • bKGD
    • hIST
    • pHYs
    • sPLT
    • eXIf
    • tIME
    • acTL
    • fcTL
    • fdAT
  • Extensions to the PNG specification (Version 1.6.0):
    • oFFs
    • gIFg
    • gIFx
    • sTER
  • ImageMagick private chunks:
    • vpAg
    • caNv
    • orNt
  • Skitch/Evernote private chunks:
    • skMf
    • skRf
  • Microsoft private chunks:
    • msOG
  • Worms Armageddon private chunks:
    • waLV
  • GLDPNG private chunks:
    • tpNG

Unknown chunks can still be listed and queried but only very basic informations will be displayed.

The -s option can be handy if garbage is placed at the beginning of a file. pnginfo -s will try to skip said garbage until it finds an acceptable PNG signature.

Example:

$ curl https://example.org/file.png | pnginfo -s -l

pngdump

This utility dumps a raw chunk from a PNG file or optionally its data segment.

Example - extract the original gif from a msOG chunk:

$ pngdump -d -o 11 -f samples/msOG.png msOG | file -
/dev/stdin: GIF image data, version 89a, 32 x 32

Example - extract the original png from a skRf chunk:

$ pngdump -d -o 16 -f samples/skRf.png skRf | file -
/dev/stdin: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced

License

All the code is licensed under the ISC License. It's free, not GPLed !

lgpng's People

Contributors

tleguern avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

grylem mohanagy

lgpng's Issues

macOS compile warnings

Hi
pnginfo.c:592:33: warning: passing 'char *' to parameter of type 'const Bytef *' (aka 'const unsigned char *') converts
between pointers to integer types with different sign [-Wpointer-sign]
zret = uncompress(out, &outz, ztxt->text, ztxtz);
^~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/zlib.h:1276:49: note:
passing argument to parameter 'source' here
const Bytef *source, uLong sourceLen));

and

compats.c:122:8: warning: implicit declaration of function 'memset_s' is invalid in C99 [-Wimplicit-function-declaration]
(void)memset_s(p, n, 0, n);
^
compats.c:122:8: warning: this function declaration is not a prototype [-Wstrict-prototypes]

Regards.

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.