I'm working in the GIMP; can anyone give me a hand here?
Transparency in PNGs
Moderator: Graf Zahl
-
Caligari_87
- Posts: 45
- Joined: Tue Nov 08, 2005 18:26
- Location: Salt Lake City, Utah
Transparency in PNGs
Okay, I have PNGs working for Haloguns; the question I have now is, how can I apply varying levels of translucency to the image, say for muzzle flares? If I try to convert the image to 8-bit, all my alpha information is discarded, making it either "transparent or not".
I'm working in the GIMP; can anyone give me a hand here?

I'm working in the GIMP; can anyone give me a hand here?
-
Nash
- Developer

- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
-
Caligari_87
- Posts: 45
- Joined: Tue Nov 08, 2005 18:26
- Location: Salt Lake City, Utah
-
Nash
- Developer

- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
Cals! I figured it out!
Okay first, prepare the images. I read that you have alpha masks mapped out nicely in the gimp so you're good to go. Save as true-colour PNG so that the alpha will be retained.
NEXT STEP: As Graf said in the other thread; Google for PNGQUANT. It's very easy to use but if you prefer a GUI version, it's available on the pngquant's page too.
Run pngquant like this:
pngquant -force 256 <your picture.png>
Voila! Your PNG is converted to 256 colours, but the alpha is still there. Your file will be saved as the original file name, with an -fs8 sufffix. Example M_DOOM.PNG will have an output of M_DOOM-fs8.png.
EDIT NOTE: Your PNG might appear screwy in your paint program (the gimp, Photoshop, etc). Don't worry. It will look great in GZDoom if imported correctly with XWE (import as raw data).
Now you probably have an assload of files to convert. You can either do it the manual way...
pngquant -force 256 pic1.png pic2.png pic3.png pic4.png pic5.png ... etc...
Or you can download the GUI.
Once your PNG has been converted to 8 bit, you can use Randy's SetPNG to apply offsets. Easy!

Rebirth's M_DOOM replacement logo with smooth alpha fade outs!
Okay first, prepare the images. I read that you have alpha masks mapped out nicely in the gimp so you're good to go. Save as true-colour PNG so that the alpha will be retained.
NEXT STEP: As Graf said in the other thread; Google for PNGQUANT. It's very easy to use but if you prefer a GUI version, it's available on the pngquant's page too.
Run pngquant like this:
pngquant -force 256 <your picture.png>
Voila! Your PNG is converted to 256 colours, but the alpha is still there. Your file will be saved as the original file name, with an -fs8 sufffix. Example M_DOOM.PNG will have an output of M_DOOM-fs8.png.
EDIT NOTE: Your PNG might appear screwy in your paint program (the gimp, Photoshop, etc). Don't worry. It will look great in GZDoom if imported correctly with XWE (import as raw data).
Now you probably have an assload of files to convert. You can either do it the manual way...
pngquant -force 256 pic1.png pic2.png pic3.png pic4.png pic5.png ... etc...
Or you can download the GUI.
Once your PNG has been converted to 8 bit, you can use Randy's SetPNG to apply offsets. Easy!

Rebirth's M_DOOM replacement logo with smooth alpha fade outs!
-
Graf Zahl
- GZDoom Developer

- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
-
DaniJ
- Posts: 130
- Joined: Sat Oct 08, 2005 19:22
-
Graf Zahl
- GZDoom Developer

- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
-
Nash
- Developer

- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
-
DaniJ
- Posts: 130
- Joined: Sat Oct 08, 2005 19:22
As I said, the format itself is considered a FREAK within the industry so practically ALL commercial/big name graphics packages don't support it (other than the abomination that is FireWorks). That format was originally designed for web use only. Also, don't forget it was a brainchild of Macromedia and since they were bought out by Adobe over a year ago you can expect to never see support in PhotoShop. As such the format has been abandoned to the mists of time.What's the problem with this format? It is official PNG standard but yet I haven't found a single tool that can read it without destroying the alpha channel. Especially when the same tools are perfectly capable of reading 32 bit alpha PNGs!
In the "real" world of modern game graphics, this is how it works:
If your engine supports DX texture formats - use them.
If you only need greyscale info (eg bump/spec map/alpha) - use RAW or if your engine supports it (and file size doesn't matter) - use 8bit PCX and convert to 1byte per pixel at runtime)
If you only need 8bit colour (no alpha) - use PCX
If you need alpha - use PNG32bit or TGA*
Otherwise, use PNG24bit.
* If you have the benefit of DX textures this isn't a hardnfast rule. DX formats support varied levels of alpha (1bit, 4bit and 8bit) so you choose the format best suited to the texture.
If I'd known you were trying to use PNG8bit+A I would have pointed this out earlier...
-
Nash
- Developer

- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
-
Caligari_87
- Posts: 45
- Joined: Tue Nov 08, 2005 18:26
- Location: Salt Lake City, Utah
-
Graf Zahl
- GZDoom Developer

- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
DaniJ wrote: In the "real" world of modern game graphics, this is how it works:
If your engine supports DX texture formats - use them.
If you only need greyscale info (eg bump/spec map/alpha) - use RAW or if your engine supports it (and file size doesn't matter) - use 8bit PCX and convert to 1byte per pixel at runtime)
If you only need 8bit colour (no alpha) - use PCX
If you need alpha - use PNG32bit or TGA*
Otherwise, use PNG24bit.
What is it with the 'real' world that it tends to hold on to outdated formats. PCX is as obsolete as they come.
PNG could easily replace all of these without any hassle.
-
Nash
- Developer

- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
Cals, unfortunately that's where I wasn't impressed with PNGQUANT. It doesn't seem to do a good job at whatever it's doing.
I compared an in-game screenshot of my title graphic, and the same graphic that is converted to 8-bit from WITHIN Photoshop. The Photoshop-converted graphic looks better than what PNGQUANT does to my picture.
If you observe the screenshot I posted above, you'll see several black pixels scattered messily around the picture. I don't have any God damn black pixels in the first place.
Photoshop will convert the image to 8-bit fine, although transparency will be lost).
I've tried both dithering modes that PNQUANT uses - both yielded disappointing results.
If that is supposed to prove anything, heh.
I compared an in-game screenshot of my title graphic, and the same graphic that is converted to 8-bit from WITHIN Photoshop. The Photoshop-converted graphic looks better than what PNGQUANT does to my picture.
If you observe the screenshot I posted above, you'll see several black pixels scattered messily around the picture. I don't have any God damn black pixels in the first place.
Photoshop will convert the image to 8-bit fine, although transparency will be lost).
I've tried both dithering modes that PNQUANT uses - both yielded disappointing results.
If that is supposed to prove anything, heh.
-
DaniJ
- Posts: 130
- Joined: Sat Oct 08, 2005 19:22
PCX is still a useful format when you don't have DX around. I'm only reporting on what I've learned from taking apart other FPS games (Quake series, UT series, PainKiller, FarCry etc etc) and lots of research for jDRP. By trade I'm a web developer...What is it with the 'real' world that it tends to hold on to outdated formats. PCX is as obsolete as they come.
-
Caligari_87
- Posts: 45
- Joined: Tue Nov 08, 2005 18:26
- Location: Salt Lake City, Utah