GithubHelp home page GithubHelp logo

runt18 / pngquant Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kornelski/pngquant

0.0 2.0 0.0 2.58 MB

Lossy PNG compressor — pngquant command and libimagequant library

Home Page: https://pngquant.org

License: Other

Makefile 1.84% C 93.99% Groff 1.84% Objective-C 1.14% Shell 1.19%

pngquant's Introduction

#pngquant 2

This is the official pngquant and libimagequant.

pngquant converts 24/32-bit RGBA PNGs to 8-bit palette with alpha channel preserved. Such images are fully standards-compliant and are supported by all web browsers.

Quantized files are often 60-80% smaller than their 24/32-bit versions.

This utility works on Linux, Mac OS X and Windows.

##Usage

  • batch conversion of multiple files: pngquant *.png
  • Unix-style stdin/stdout chaining: … | pngquant - | …

To further reduce file size, try optipng or ImageOptim.

##Improvements since 1.0

Generated files are both smaller and look much better.

  • Significantly better quality of quantisation

    • more accurate remapping of semitransparent colors
    • special dithering algorithm that does not add noise in well-quantized areas of the image
    • uses variance instead of popularity for box selection (improvement suggested in the original median cut paper)
    • feedback loop that repeats median cut for poorly quantized colors
    • additional colormap improvement using Voronoi iteration
    • supports much larger number of colors in input images without degradation of quality
    • gamma correction and optional color profile support (output is always in gamma 2.2 for web compatibility)
  • More flexible commandline usage

    • number of colors defaults to 256, and can be set automatically with the --quality switch
    • long options and standard switches like -- and - are allowed
  • Refactored and modernised code

    • C99 with no workarounds for legacy systems or compilers (apart from Visual Studio)
    • floating-point math used throughout
    • Intel SSE optimisations
    • multicore support via OpenMP
    • quantization moved to standalone libimagequant

##Options

See pngquant -h for full list.

###--quality min-max

min and max are numbers in range 0 (worst) to 100 (perfect), similar to JPEG. pngquant will use the least amount of colors required to meet or exceed the max quality. If conversion results in quality below the min quality the image won't be saved (if outputting to stdin, 24-bit original will be output) and pngquant will exit with status code 99.

pngquant --quality=65-80 image.png

###--ext new.png

Set custom extension (suffix) for output filename. By default -or8.png or -fs8.png is used. If you use --ext=.png --force options pngquant will overwrite input files in place (use with caution).

###-o out.png or --output out.png

Writes converted file to the given path. When this option is used only single input file is allowed.

###--skip-if-larger

Don't write converted files if the conversion isn't worth it.

###--speed N

Speed/quality trade-off from 1 (brute-force) to 11 (fastest). The default is 3. Speed 10 has 5% lower quality, but is 8 times faster than the default. Speed 11 disables dithering and lowers compression level.

###--nofs

Disables Floyd-Steinberg dithering.

###--floyd=0.5

Controls level of dithering (0 = none, 1 = full). Note that the = character is required.

###--posterize bits

Reduce precision of the palette by number of bits. Use when the image will be displayed on low-depth screens (e.g. 16-bit displays or compressed textures in ARGB444 format).

###--version

Print version information to stdout.

###-

Read image from stdin and send result to stdout.

###--

Stops processing of arguments. This allows use of file names that start with -. If you're using pngquant in a script, it's advisable to put this before file names:

pngquant $OPTIONS -- "$FILE"

pngquant's People

Contributors

kornelski avatar pdknsk avatar benkasminbullock avatar craigbarnes avatar znerd avatar jaalto avatar rolftimmermans avatar dwbuiten avatar toy avatar turboencabulator avatar philippec avatar swillits avatar sergiomb2 avatar dunn avatar mdonoughe avatar naoliv avatar rflynn avatar safari77 avatar ssuominengentoo avatar undercooled avatar ph0b avatar apache9 avatar

Watchers

 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.