|
![]() |
| GIF flower without variable transparency |
![]() |
| PNG flower with variable transparency |
You might use browsershots to check out PNG support in various browsers by looking at the renderings of this page http://mindprod.com/jgloss/png.html at http://browsershots.org.
*.png compression uses zlib, same as the gnu GZIP and Java jar utilities. On most 8-bit images, the *.png form will be about 11% smaller than the *.gif form. Java 1.4.1+ supports *.png officially in the Advanced Imaging Kit. You can use *.png images with Toolkit.getImage.
Unfortunately Java Web Start in Java version 1.5 and earlier does not support *.png files for the jnlp <icon image, just *.gif and *.jpg. Support for arrived with JDK (Java Development Kit) 1.6.
You can test your browser’s *.png support. You should see an image of a huge spiky red flower to the right of the table above, with proper fades into the transparent background, with no white halos. IE 5.5 and 6.0 do not show it at all. IE can handle some transparent backgrounds but not others. Netscape 4.79 shows it with a purple background. Netscape 8.0+ shows it correctly. Opera, Mozilla, SeaMonkey and Firefox display it correctly. See Masker for details. You can also click here and here for more tests.
The *.png file header looks like this:
| PNG Header Format | ||
|---|---|---|
| Field | Contents | Size |
| signature | \211PNG\r\n\032\n
i.e. hex 89504E470D0A1A0A |
8-bytes |
| chunksize | 0x0000000D | 4 bytes big-endian binary |
| chunkid | IHDR
i.e. hex 0x49484452 |
4 bytes |
| width | 4 bytes big-endian binary | |
| height | 4 bytes big-endian binary | |
The ImageInfo class will give you the width and height of *.png images (also *.gif and *.jpg) without loading them. It just read the first few bytes of the file.
You can see if your browser displays both styles of PNG image correctly:
Here is the code for a program to draw a simple image, then save it as a *.png file.
There are also animated PNGs (Portable Network Graphics) that work much like animated GIFs (Graphic Interchange Formats) called Animated PNG, or APNG (Animated Portable Network Graphics). It supports 24-bit colour and 8-bit alpha transparency. Opera 9.5+ and Firefox 3.0+ support it. IE, Safari, Flock and Sea Monkey do not support it. They just display the first frame.
![]() |
recommend book⇒PNG: The Definitive Guide | |||
| by | Greg Roelofs | 978-1-56592-542-7 | paperback | |
|---|---|---|---|---|
| publisher | O’Reilly | |||
| published | 1999-06-01 | |||
| Out of print. More than you wanted to know about *.png image format. Available to browse free as an eBook. | ||||
| Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder. | ||||
|
|
available on the web at: |
http://mindprod.com/jgloss/png.html |
optional Replicator mirror
|
J:\mindprod\jgloss\png.html | |
![]() |
Please email your
feedback for publication,
letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear
wording, broken/redirected link reports, suggestions to improve this page or comments to
Roedy Green :
| |
| Blog | Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[107.21.156.140] |
|
| Feedback | You are visitor number 33,824. | |