Archive for June, 2009
Improved tools for optimising PNG images – pnqnq and pngquant “Improved”
I’ve taken the liberty of creating WIN32 builds of Kornel Lesinski’s improved pngnq and improved pngquant open source tools.
pngnq and pngquant reduce the file size of a PNG file by reducing the number of colours, using advanced algorithms which produce the most visually pleasing results given the limitations.
pngnq and pngquant are capable of producing 8-bit (or less) optimised images which still contain alpha transparency (fully varied transparency), something which Photoshop cannot do!
This package contains
- Improved pngnq v0.9 (January 2009)
- Improved pngquant v1.1.1 (January 2009)
- Sample batch files
- Full source code and any original open source licenses
Download pngnq and pngquant command-line tools for Win32 now
What they’re for
pngnq and pngquant perform lossy compression of PNG images, by reducing the number of colours appearing in the image.
There are many different approaches to doing this, and most graphics applications capable of saving to PNG or GIF images have some algorithm for reducing a full colour image down to an image with a limited number of colours. Different algorithms vary in terms of visual quality and processing time. pngnq and pngquant aim for maximum possible visual quality at the expense of a longer processing time (though they are, to some extent, adjustable), and generally do perform better at this than most graphics software.
Choosing a fixed number of colours to best present a full-colour image is not an easy task, and as such there are a few different approaches.
One approach is to use a fixed set of colours regardless of the image; this is the simplest but also the worst quality approach.
Other approaches look at what colours actually appear in the image, and try to cover the most common ones. Of these, there is still a variety of approaches: median-cut based colour selection picks colours by repeatedly calculating median values of the colours in the full-colour image. Other, more ‘perceptual’ approaches try to place more emphasis on areas of the image where small colour variations are more likely to be noticed by the human eye, and less emphasis on ‘busier’ areas of the image. In the best case, such an algorithm can often produce a reduced colour image that is indistinguishable from the original, by the human eye.
pngquant is a general open source tool to do just this, and can accept pretty much any type of PNG image as its input, though a true-colour PNG, optionally with alpha transparency information, is best. It is a command-line tool, and is cross-platform.
pngnq is an alternative to pngquant which uses the neuquant algorithm, a more complex algorithm which aims to produce better results. It is also command-line and cross-platform. It evolved from an earlier version of pngquant.
Kornel Lesinski’s improved pngnq and improved pngquant tools add some further minor improvements to pngnq and pngquant’s algorithms, giving more pleasing (to my eye) results for images with alpha transparency, especially antialiased boundaries for example on icons. They also contain other various fixes, as documented on their respective web pages, which improve results in some edge cases.
You can choose how many colours you want to end up with, with 256 as the maximum; unlike GIF, PNG’s efficiency does not really suffer if you choose a palette size that is not a power of two.
The resulting PNG images will be viewable in all modern browsers, with an important exception: in Internet Explorer 6, images with alpha transparency will not display their partially transparent areas. Thus, the images will look a lot like they have just 1-bit transparency. Some see this as still better than the alternative of not using alpha transparency, or using full-colour images with alpha transparency and having them completely broken on IE6, due to the relatively graceful way these images degrade on IE6. You should test the results in IE6 and decide for yourself, on an image-by-image basis.
Download pngnq and pngquant command-line tools for Win32 now
Add comment 26 June, 2009
Figuring Twitter out
The success of Twitter always puzzled me – it was probably the first massively popular web phenomenon that I just could not get. I don’t spend a lot of time on World of Warcraft, or Second Life, but at least I can easily understand their appeal, and why people use them. For Twitter, I just could not understand it.
‘Why would anyone use a service so restrictive and limited in use, and like it?’, I thought. For one, it’s full of self-promotion, utilised by many as one big PR tool. I felt like I was being spammed every time I visited (until, that is, I learned to un-follow any of ‘those’ accounts), and at other times it just looked like a whole bunch of ‘in’ people sharing ‘in’ jokes and having their own little private conversations to which I was not invited, but which were nonetheless put out in the public, as if to say ‘look at me, I actually have friends’ or ‘geek is the new trendy’.
To help myself to understand it – without necessary aiming to like it, but just to get a better grasp of why others did – I told myself eight days ago that I would put something on my Twitter (Tweet?) at least one a day.
- Installing TwitterFox has helped. Now I don’t need to go through the hassle of loading a website just to do something which should be trivially easy to do, given you are writing just a few words.
- The @ signs in messages annoy me. Twitter should just hide the @, allowing you to link to another user without it looking like some sort of secret geek language.
- The need to use URL shorteners annoys me. Twitter should just hide the URL and show it as link text instead, allowing the link to show up as part of your sentence, you know, like in HTML. This is probably the single most embarrassingly backward feature of Twitter, so lacking that an entire industry of ‘URL shortening services’ has thrived as a result of this limitation. Imagine their lack of
- Twitter is not open. It’s controlled by one company (and doesn’t have a good record of staying up). Can I host a Twitter site on my own server? I guess this point is kind of moot; as much as I find it mildly irritating, most people, unlike me, don’t really care too much about ‘freedom’ in that sense. But even a viable Twitter competitor would open up the market a bit. I may check out identi.ca at some stage.
- I have been inspired by the likes of Sockington, who I think uses the Twitter format really well.
All in all, I’ve found that it is actually easier to maintain a regular posting habit on Twitter than on my blog, which is refreshing. A week ago I didn’t understand the point of Twitter at all, and while I still see Twitter as largely made up of chaff I can now understand that it is like any other self-published media, including blogging: 95% of it is uninteresting, but the 5% that’s good can make it an enjoyable experience.
You can check out my Twitter here and tell me if I am a twit or not.
1 comment 17 June, 2009