GithubHelp home page GithubHelp logo

morristech / pngtastic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from depsypher/pngtastic

0.0 1.0 0.0 20.39 MB

A pure Java PNG image optimization and manipulation library

License: MIT License

Java 100.00%

pngtastic's Introduction

Pngtastic

A pure Java API for dealing with PNG images

Pngtastic is PNG for Java. Just one small jar with no dependencies. It doesn't rely on AWT, so it can be used in restrictive environments like Google App Engine (and probably Android, but haven't tried).

The currently supported operations are:

  • File size optimization
  • PNG image layering

Available in Maven

<dependency>
    <groupId>com.github.depsypher</groupId>
    <artifactId>pngtastic</artifactId>
    <version>1.2</version>
</dependency>

New: Support for Zopfli compression!

The latest code adds the ability to optimize png images using the new zopfli deflate compression algorithm. The java port is based heavily on this.

If you're willing to sacrifice compression speed in exchange for ridiculously good compression ratios, you'll want to try using the optional zopfli compressor.

Example usage:

$ ant dist
$ java -cp build/dist/pngtastic-1.1.jar com.googlecode.pngtastic.PngtasticOptimizer --compressor zopfli --iterations 32 --fileSuffix .min.png images/optimizer/amigaball.png

So far I'm seeing better compression ratios for my test images than even the excellent ImageOptim app produces.

Here's a taste (ordered from worst to best compression):

Pngtastic Default Compression
[pngtastic] 59.76% :   169B ->    68B (  101B saved) - build/images/optimizer/1px.png
[pngtastic]  5.99% : 35731B -> 33590B ( 2141B saved) - build/images/optimizer/amigaball.png
[pngtastic]  0.01% :251938B ->251922B (   16B saved) - build/images/optimizer/frymire.png
[pngtastic] 22.37% : 93167B -> 72322B (20845B saved) - build/images/optimizer/gamma.png

ImageOptim Compression
[ImageOptim] 59.8% :   169B ->    73B - build/images/optimizer/1px.png
[ImageOptim]  11.2% : 35731B -> 31729B - build/images/optimizer/amigaball.png
[ImageOptim]  8.7% :251938B ->230055B - build/images/optimizer/frymire.png
[ImageOptim] 28.5% : 93167B -> 66607B - build/images/optimizer/gamma.png

Pngtastic Zopfli Compression
[pngtastic] 61.54% :   169B ->    65B (  104B saved) - build/images/optimizer/1px.png
[pngtastic] 12.21% : 35731B -> 31370B ( 4361B saved) - build/images/optimizer/amigaball.png
[pngtastic] 10.40% :251938B ->225749B (26189B saved) - build/images/optimizer/frymire.png
[pngtastic] 29.27% : 93167B -> 65895B (27272B saved) - build/images/optimizer/gamma.png

pngtastic's People

Contributors

depsypher avatar kageiit avatar

Watchers

 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.