TinyPNG: Lossy compression for PNG that preserves full transparency.
tinypng.org
tinypng.org
To compare yourself:
wget http://tinypng.org/images/example-orig-c549c73a.png
wget http://tinypng.org/images/example-shrunk-ec364794.png
pngnq example-orig-c549c73a.png
cmp -b example-orig-c549c73a-nq8.png example-shrunk-ec364794.png
I get one byte of difference between what pngnq produces and their example shrunk version.BTW, I use pngnq all the time in instances where losing some information is okay. It's a great tool.
Websites of 2012, I am disappoint.
It would be cool if they created an API as well, and a library (but for what language? so many compatibility issues...), but to say this should "not be a website" is entirely backwards. A website is the most user-friendly and accessible platform possible, and makes perfect sense to be the first step.
If it were a library the program that created the PNG could have saved it in this compressed form in the first place.
Choosing the language isn't an issue, either. The obvious choice is C because that's what regular libpng is written in. And every language in existence provides a way to interface with C.
For designers it should be a Photoshop plugin (built on the theoretical library) or just a desktop app that can bulk convert entire directories.
While dealing with 20 images at a time is certainly nicer than one at a time, a drag & drop website UI like this one is an absolute workflow killer on the design side.
My point is, a website interface the single most accessible way so that 100% of people can use it, regardless of platform or programming expertise.
It is the obvious first choice. That said, of course I hope all the other options come along soon...
If this were a library or a command line app like pngcrush, web services could be spawned from it in days, easily. Or desktop apps. Or editor plugins. But in the current format, it's inextensible.
(disclaimer: this isn't always true, but it's true in this case)
So this should not be a plugin for gimp, but rather a bug fix.
It would also be nice if gimp could open images with indexed transparency.
EDIT: I suppose this software is equivalent to gimp's "Automatically select palette" option when converting images to indexed. Perhaps that option could be replaced with a list of algorithms to choose from, like how the Size dialog lets you choose your own scaling algorithms.
I'm not sure you really need multiple algorithms, the algorithm itself isn't anything special as far as I know - it just supports transparency that's all.
You can get somewhat similar results by selecting all the transparent and partially transparent parts and saving the selection. Then flatten the image (i.e. mix the transparency into the background color), reduce the color depth, then use the color to alpha option only on the selection (not the whole image) to subtract the color and bring back the transparency.
Then count how many colors you have, if you have too many, undo everything, and choose a lower number for color depth and try again. It helps to choose a color that does not otherwise exist in the image for the background mixing color.
A website requires a browser, a human, and bunch of clicking around. Every single time you want to do this.
API / library requires script to be written and added to production pipeline. Once. Then runs without human intervention.
The most human friendly interface is the one that saves humans from doing boring, tedious, automatable tasks.
We created this service because we (our web agency) were building a couple of sites that used very large transparent images. Unfortunately the file sizes were also massive, so we went looking for compression mechanisms beyond traditional lossless optimisation tools, which simply did not reduce our files enough. We built TinyPNG around a couple of existing open source quantising and compression tools.
Initially it was an internal tool, but we were extremely surprised by the consistent good quality of the results. So we decided to share it as an online service so that it is as easy as possible for everyone to reduce file sizes. An API will be coming soon!
Is it always a good idea to use lossy compression? No, certainly not. There are some edge cases that perform poorly. But we think the results are impressive. Use your own judgment! :-)
We actually went looking for PNG files on very popular sites (Facebook, Google, Github, Duckduckgo, many others) and almost all of them could benefit from TinyPNG's file size reduction without noticeable quality loss.
So I took a PNG from wikipedia:
221.0kb (its actually 215 KB or a little more than 220,000 bytes) to a claimed 47.8 KB (really 46.7 KB). Nice!
Running PNGGauntlet, a lossless compression app, with the same file compressed nothing. Wise wikipedians must have already done that.
But the results from tinypng look awful. Here you can flip between the original and the compressed:
http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_trans...
It's a trade-off, but I would imagine that if there's thousands of files it could be a significant savings on bandwidth, and you could always keep the original for download but not display puroses.
That shouldn't be surprising -- high color depth images need more than 256 colors to represent their image with fidelity.
256 colors may simply not be enough for this image.
(Incidentally I was able to slightly reduce your image to 46K with pngout.)
If you have a good downscaling tool it will create a larger number of intermediate colors when you downscale and you'll actually end up with a larger image!
> With TinyPNG the background becomes transparent again. No workarounds!
Um, does anyone know how that works? Does IE6 natively support some kind of png transparency?
EDIT: ah, like that: http://calendar.perfplanet.com/2010/png-that-works/#8bit+alp...
What the hell?
I mean, this would have actually been really useful for me... like, five years ago.
Heck, I'm sitting here on XP, developing specifically for IE6 and nothing else.
(Note: I'm not saying I like it, just that it's become "normal")
Also see http://pngnq.sourceforge.net/index.html
There are several other image optimization tools incorporated into a OS X tool http://imageoptim.com/
It must be a start-up with a freemium model. Soon they will reveal a monthly subscription option with a professional bulk uploader in Flash or even a desktop client. Just wait and see.
On Linux you can get the same by using pngquant, then using trimage. AFAIK there's no GUI frontend for pngquant so I guess how many colours would be ok and check before running trimage.
The reason why I use 2 tools is that ImageAlpha/pngquant is lossy and ImageOptim/trimage is lossless.
This website looks neat, but it seems like a CLI that can become part of my automated workflow would generally be more useful.
I wish Photoshop gave the option to save an 8-bit PNG with a FULL alpha channel—that's what this seems to do.
Moreover, ImageMagick itself recommends a variety of more advanced lossless and lossy png compression utilites: http://www.imagemagick.org/Usage/formats/#png_non-im
Then I opened the original panda PNG with GIMP, clicked on Image -> Mode -> Indexed -> Optimized palete -> 255 colors, and obtained an even smaller file size.
What's so special about this?
The difference is in quality of quantization. The poorer the algorithm, the more banding artifacts or dithering noise you'll get.
Usually less optimal quantization also gives worse quality/filesize ratio (since palette entries are "spent" on less noticeable areas of the image).
Exactly: I don't see what's special about tinyPNG.
Matt gets into the guts of how this process works here: http://www.mattwrock.com/post/2011/09/05/Convert-32-bit-PNGs...
Also, ImageOptim provides a GUI that does lossless PNG compression:
Also, the original has values in the RGB channels for pixels with no alpha that aren't visible (due to the alpha) but need to be compressed, so it's not a fair test (although both do to some degree - turquoise area around the bear), so the new one could be compressed even more.
However the distortion is merely a side-effect of reducing image to 256-colors (from 15k colors).
(from the creator of the equally awesome ImageOptim: http://imageoptim.com/)
AlphaImage will even give you the 'optional' Transparent PNG compatible with IE6.
For example, as a greedy algorithm: find the best predictor for a line, then tweak the line to reduce the alphabet (round off the difference from predicted values) or to get longer deflate matches (substitute values if they're close and match a previous run).
NO MORE GIF's for me!
10,842 bytes -> 15,863 bytes (a 46% increase).
Which is dumb, in cases like this it's better to return the original file.