Posts filed under ‘Web tools’

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

26 June, 2009 at 5:25 pm 4 comments

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.

17 June, 2009 at 7:24 pm 2 comments

Is Gmail suitable for use as your main email box?

Now that Gmail offers proper IMAP access for free, I think that there are few reasons not to use Gmail for all my non-work email now.

Gmail’s 7GB (and growing) amount of space allows it to be a ‘store everything’ type of mail box, as opposed to a ‘store what I haven’t downloaded yet’ (as in POP) or ‘store the last x days’ worth’ (as in an IMAP box that’s only small).

My web hosting provider allows POP or IMAP access, but it’s restricted to only 100MB, so it’s not really usable as a ‘store everything’ box, not to mention that I might change hosting providers some day.  I really love my host, but the possibility exists that I’ll outgrow them or need some new whiz-bang feature one day.

My current email strategy is:

  • Download all mail to my home computer, but have it left on the server for 7 days.
  • I can still access at least the last 7 days’ worth of mail when I’m away from home.
  • My Gmail account fetches mail from my mailbox via POP every x minutes, so I have another copy of everything on Gmail.

That third point was to be a temporary measure, but I find it just too convenient to be able to search all my mail on Gmail while I am away from home.  I might as well forward everything to Gmail.

More points about Gmail:

  • Gmail doesn’t force you to use your ‘@gmail.com’ address as your ‘from’ address.  You can use an address with your domain name in it as a default.  Therefore Gmail does not suffer from the type of ‘lock-in’ – if you move to a new provider, you can keep your email address.
  • Gmail’s web interface is better than any web interface I have seen an ISP or a web hosting provider provide.  It even rivals desktop based email clients.
  • Keeping a copy of everything on Google’s server acts as a really easy, free, form of off-site backup.  My current off-site backup strategy consists of burning a DVD of my Thunderbird mail box folder every other month if I remember it, and tucking the DVD into a drawer at work.

The only hesitation I have, but one which I feel is pretty important, is that entrusting all of my email to Google would vastly increase the amount of damage done should an attacker – or a Google employee (unlikely) – gain access to my account.  Rather than just 7 days’ worth of emails being available, as with another provider, Google would store an entire history of possibly personal and confidential mail.  This includes such secrets as password reminder emails for online services.  I’d feel better about it if I could encrypt Gmail’s entire contents with my own key, that Google themselves didn’t have access to, and nor did anyone who had gained access to the account.  Of course, it’s not really possible with the way Gmail works.

So, is using Gmail worth it as a ‘store everything’ mail box for personal email?

13 February, 2009 at 9:00 pm 1 comment

Firefox 3 approaches

Pre-release versions of Firefox 3 are now available, and they are looking pretty interesting. Here are a few warnings though if you are tempted to try upgrading now:

  • Existing add-ons in the form of extensions or themes will probably not work anymore if you upgrade.
  • It doesn’t yet ‘look’ polished. Firefox 3 will have a new visual appearance, which the pre-release versions don’t have yet.
  • There are some annoying bugs, but aren’t there always. For instance you can’t yet drag and drop a bookmark into a bookmark menu.
  • If you don’t like it and decide to downgrade to Firefox 2 again, you’ll lose access to bookmarks you created while you were using Firefox 3 (there is a way around it though).

With those warnings aside, here are some of the neat things I found.

  • Rendering pages is faster due to the new rendering engine. If you have a decent enough internet connection you’ll probably notice the benefit.
  • The address bar lets you search your browsing history, and shows titles and URLs of results. You can also bookmark things in one click using the ‘star’ in the address bar.
  • You can resize the search box (ie the Google search box) so it’s bigger.
  • There is a list of automatic bookmarks which contains your frequently visited pages.

There are lots of changes to the way bookmarks and history are handled, and thankfully lots of these changes are not noticeable at all. There are also changes to the way secure connections are described, to avoid the implication that a site can be trusted if it is using a secure connection. There are also thousands of other bug fixes.

I really like following Firefox’s development because anyone can see how bugs are fixed and how patches to the code are accepted, and it somehow works – it creates a good product.

11 January, 2008 at 1:59 pm Leave a comment

Why I (used to) recommend WinSCP over FileZilla for your FTP and SFTP needs.

15 February 2009 update: In the time since I originally wrote the following article,  FileZilla 3 has improved to the point where I am beginning to prefer it again over WinSCP.  Most of my problems with it have been fixed, including issues such as not maximising the window and columns that were too narrow.  Missing features have also been added, such as a right-click menu allowing editing of files in the local pane.  As of recently FileZilla has also added a synchronised browsing mode just like WinSCP.  I still miss being able to set a custom background colour for each site preset though.

With the release of FileZilla 3.x beta versions, I switched to WinSCP. Now in version 4, WinSCP finally supports regular FTP as well as just SFTP, making it a genuine competitor to FileZilla. There have always been things that annoyed me in FileZilla, and I was a little disappointed by what I saw in 3.x versions – especially the fact that many of the annoying bugs were not fixed and there were new bugs that were worse.

Even after 11 beta releases of FileZilla 3.x, I still encountered the following new bugs.

  • No longer remembers the positions of panes between sessions.
  • No longer remembers whether the window is maximised between sessions.
  • Column widths are not remembered between sessions, and the default column widths are too narrow. The filename column is not wide enough to show an 8.3 filename, for example, and the date column (Last Modified) is not wide enough to show a date.
  • There is nothing to allow me to double-click to edit a file, or even right-click and choose ‘Edit’ from the context menu like I could in the older version. I can’t seem to open a file in my text editor from FileZilla (unless I drag and drop, but then my text editor needs to be open already).
  • Navigating in the left hand (local) pane is noticeably slower, especially when using a network drive. I think loading the file icons is slower. It’s much slower than the right hand (remote) pane, anyway, which is silly.

The 3.x betas also didn’t fix some of the problems I’ve always had with FileZilla, that I just put up with.

  • When I open FileZilla, it doesn’t appear in the foreground or on the Windows task bar until I give focus to it some other way, such as by minimising other windows.
  • SFTP transfers are fairly slow.

So I switched to WinSCP after the 11th beta and I have been happy since. I think WinSCP is much easier and nicer to use. I particularly liked the following features.

  • I quite liked the way that ‘advanced’ preferences were hidden by default, and when I showed them, they are all set to how I would have had them anyway, so I don’t need to worry about them.
  • I love the ‘synchronised browsing’ mode. Whenever I used FileZilla I always wished that it would have something like that.
  • Dragging and dropping, and right-clicking on files to edit or view them, works like it should (or rather, like I am used to from regular explorer windows). The only exception to this is that F5 does not refresh – it’s actually Ctrl+R.
  • I can set up profiles including what background colour should be used for my session, allowing me to use colour to differentiate between ‘live’ and ‘staging’ server connections for example where they would otherwise look pretty much the same.

9 November, 2007 at 11:21 am 1 comment


Tweets

Error: Please make sure the Twitter account is public.