|
What is a PNG?
PNG is one of the many graphics formats. I'll start with BMP,
the simplest, which stands for Bit MaP. That is
just a straight array of pixels as on a screen or in a photo; so many wide by, so many
high. GIF (which stands for Graphics Interchange
Format) is similar but has
compression (RLE - run length encoding) where if you have a string of pixels all the
same colour they are encoded as the number of pixels in the run and what colour they
are, which is much shorter (you can have RLE on BMP too but they are usually
without). GIF also has a facility for transparency. PNG
(Portable Network Graphics) is similar to GIF but has 15 levels
of transparency from clear to opaque. There are loads of different formats with
jpeg being the one we use for photographs. I only mention PNG to avoid people
falling in to the trap that many web designers do; that "JPEG is good for everything".
How do we know what format an image is?
This can be tricky. This is one of the areas where Microsoft has not
done a good job. A more or less universal convention on PCs is that files have
names of the form filename.ext where "ext"
(extension) is used to
define what type of file it is. For example .doc can be a word document, .txt
can be a plain text file, .exe is an executable program. Unfortunately, and this
is not Microsoft's fault, it is only a convention, not a standard. People who
develop software choose their own extensions, usually picking something meaningful,
but sometimes the same extension is used for different file types. For example
there are at least five types of CMD file. What Microsoft did wrong was to have
an option to hide the extension and set this ON by default.
This means you can have two different files on your system FRED (.jpg) and FRED (.png)
and not be able to tell at first sight which was which. Even worse you could
receive in your mail an attachment called READ.ME.EXE or INVOICE.DOC.EXE which Windows
would show as READ.ME or INVOICE.DOC, tempting the unwary to click on it and promptly
get infected.
They claimed it was to avoid people who didn't know what they were
doing using the wrong extensions. It was a bad solution to the problem and
didn't resolve it anyway, it just made things worse. There are images still
entered in to competitions which are named as JPEGs but which are other formats,
which brings me back to the question: "How do we know what format an image is?".
Most image files have some
layout information in a header at the start of the file. No, I am not expecting
you to get a filedump and work it out. There is a very nifty program called
Irfanview which
if given a graphics file will look at the header inside the file and if it doesn't
agree with the extension will tell you it is wrong and offer to rename it for you.
Beware, DO NOT Google for Irfanview, or take any old link from the official site, most
are bundled with all sorts of unwanted rubbish. Major Geeks can be trusted.
You need to uncheck the Amazon toolbar (unless you want it), but this is the Irfanview
author that did this.
[ back ]
|