Jpeg or PNG??
by Peter Ryan aka TorQue[MoD] · in General Discussion · 01/11/2003 (7:09 pm) · 18 replies
I noticed that some of the textures (data\terrains\grassland) are actually in jpeg format.
If jpeg files work in Torque, I'm just wondering why in the world would you want to use the PNG format??? The file sizes are larger than bitmaps!
The only reason I could see to use a PNG file is for transparencies.
Anyone know of another reason?
Thanks!
-TorQue[MoD]
If jpeg files work in Torque, I'm just wondering why in the world would you want to use the PNG format??? The file sizes are larger than bitmaps!
The only reason I could see to use a PNG file is for transparencies.
Anyone know of another reason?
Thanks!
-TorQue[MoD]
#2
I think the reason PNGs are used is because they are higher quality than JPEGs. PNGs are uncompressed unlike JPEGs, which is why they have a larger file size. JPEGs have a lower image quality because they are compressed, and the more they are compressed the lower the image quality.
Mike
01/11/2003 (7:18 pm)
Hi,I think the reason PNGs are used is because they are higher quality than JPEGs. PNGs are uncompressed unlike JPEGs, which is why they have a larger file size. JPEGs have a lower image quality because they are compressed, and the more they are compressed the lower the image quality.
Mike
#3
Given this, PNGs are used because a) they have no compression artifacts, unlike JPGs b) they support high bit-depths, and c) they take up less harddrive space than any other format with qualities a and b.
01/11/2003 (7:53 pm)
While JPGs are compressed, they must be uncompressed in video memory before Torque can use them as textures. At a given size and bit-depth, every file format has the same memory requirements in the video card.Given this, PNGs are used because a) they have no compression artifacts, unlike JPGs b) they support high bit-depths, and c) they take up less harddrive space than any other format with qualities a and b.
#4
01/12/2003 (2:30 am)
Actually, PNG is compressed, too. It just uses lossless compression. And the file size definitely isn't larger than .bmp (the dumbes image format around). Remember that .png is 32 bit (truecolour + alpha transparancy channel).
#5
I mean, the Quake 3 engine uses jpeg images and it runs fine.
Aside from transparencies PNG doesn't seem all that much better. The main reason I question this is because 100 PNG textures is gonna take up a heck of a lot more room on your HD than 100 JPEGs in the highest quality compression. The fact that our game project is going to be available through download only for the first while means that a smaller overall game size makes a huge difference.
And yeah, I was comparing a 256 color bitmap to a 16bit PNG so I was wrong about the file size.
Still compared to Jpegs...
01/12/2003 (6:31 am)
Ok, but in the case of a 16bit jpeg and a 32 bit PNG file, there really isn't much of a noticeable (to the naked eye) image quality difference. And if PNG files are still compressed slightly, does it really make that much of a difference for Graphic cards?I mean, the Quake 3 engine uses jpeg images and it runs fine.
Aside from transparencies PNG doesn't seem all that much better. The main reason I question this is because 100 PNG textures is gonna take up a heck of a lot more room on your HD than 100 JPEGs in the highest quality compression. The fact that our game project is going to be available through download only for the first while means that a smaller overall game size makes a huge difference.
And yeah, I was comparing a 256 color bitmap to a 16bit PNG so I was wrong about the file size.
Still compared to Jpegs...
#6
Personaly I choose the PNG format, most game engines support PNG, There are no artifacts, file size over quality is great, and there are 2 formats which you can choose from, the 8-bit and the 32-bit so you can do alot with it. Sticking to one file format also makes editing and further development alot easier in the long run.
To further this discussion even though its off topic i would love a layered PNG format, and an engine to support it. Using code to turn layers on and off, detialed buttons could be self contained and sprite maps would be a thing of the past.
01/12/2003 (7:40 am)
There are many reasons why one would choose either JPG or PNG format, the main reason is Transparency as stated before, and the other reason File Size also stated before. Personaly I choose the PNG format, most game engines support PNG, There are no artifacts, file size over quality is great, and there are 2 formats which you can choose from, the 8-bit and the 32-bit so you can do alot with it. Sticking to one file format also makes editing and further development alot easier in the long run.
To further this discussion even though its off topic i would love a layered PNG format, and an engine to support it. Using code to turn layers on and off, detialed buttons could be self contained and sprite maps would be a thing of the past.
#7
You're making it way more complex than it has to be. For an end product, it's this simple:
* If the image needs to be pixel perfect, use PNG. Otherwise, use JPEG.
* If the image has transparency, use PNG. Otherwise, use JPEG.
* If the image is large and doens't meet the above criteria, use JPEG.
Now, for actual development, it would be wise to use PNG everywhere, unless you keep source art (Photoshop, PSP, GIMP files) handy. This is because each time you edit and re-save a JPEG, the quality will degrade. Instead of describing an image, you'd be describing a description of the image. I've seen this produce some pretty nasty artifacts at under 75% quality settings.
Depending on what program you're using, PNG can actually produce some very good file sizes. This mainly has to do with selection of color depth and compression filters. The PNGs that are saved as screenshots in Torque are completely uncompressed for speed.
01/12/2003 (10:01 am)
Peter: As Alan pointed out, the textures still have to be decompressed before loading onto the graphics card. The difference between an image loaded from PNG and an image loaded from a JPG to the graphics card is nil, for any engine. The exception is DXTC compressed textures, which Torque does support, and transparently at that. The Quake 3 engine might use JPEGs, but it also uses TGAs. There's a similar situation here with JPEG and PNG.You're making it way more complex than it has to be. For an end product, it's this simple:
* If the image needs to be pixel perfect, use PNG. Otherwise, use JPEG.
* If the image has transparency, use PNG. Otherwise, use JPEG.
* If the image is large and doens't meet the above criteria, use JPEG.
Now, for actual development, it would be wise to use PNG everywhere, unless you keep source art (Photoshop, PSP, GIMP files) handy. This is because each time you edit and re-save a JPEG, the quality will degrade. Instead of describing an image, you'd be describing a description of the image. I've seen this produce some pretty nasty artifacts at under 75% quality settings.
Depending on what program you're using, PNG can actually produce some very good file sizes. This mainly has to do with selection of color depth and compression filters. The PNGs that are saved as screenshots in Torque are completely uncompressed for speed.
#8
The lossy compression algorithm that JPEG uses was originally designed for PHOTOGRAPHY. That is what JPEG means, Joint Photography Expert Group. The lossy compression algorithm was designed for VERY large, in the HUNDREDS of MB, FULL COLOR 32bit or higher images to be transfered and archived and display NOT for working copies. Very low resolutions files do not survive even "100%" JPEG encoding very well. And textures for games at 256x256 qualify as EXTREMELY low resolution files.
PNG ( Portable Network Graphics ) is designed for a much different purpose. Mainly it support loss-less ( run length encoding ) of very high color images with lots of portability amoungs systems and workflows. Also PNG does not have the intellectional propery rights issues that other formats have. PNG supports other things at multiple alpha channels and additional embeded functionalty above and beyond what JPEG supports because it was designed for a completely opposite purpose.
01/12/2003 (8:01 pm)
To add to this . . .The lossy compression algorithm that JPEG uses was originally designed for PHOTOGRAPHY. That is what JPEG means, Joint Photography Expert Group. The lossy compression algorithm was designed for VERY large, in the HUNDREDS of MB, FULL COLOR 32bit or higher images to be transfered and archived and display NOT for working copies. Very low resolutions files do not survive even "100%" JPEG encoding very well. And textures for games at 256x256 qualify as EXTREMELY low resolution files.
PNG ( Portable Network Graphics ) is designed for a much different purpose. Mainly it support loss-less ( run length encoding ) of very high color images with lots of portability amoungs systems and workflows. Also PNG does not have the intellectional propery rights issues that other formats have. PNG supports other things at multiple alpha channels and additional embeded functionalty above and beyond what JPEG supports because it was designed for a completely opposite purpose.
#9
Its greatly appreciated. I think we'll end up using the PNG format, just one last question.
Is keeping the same file format throughout the game any easier on the graphics cards or does it not really make a difference?
Thanks again!
-TorQue[MoD]
01/13/2003 (2:28 am)
Thank you everyone for the feedback :)Its greatly appreciated. I think we'll end up using the PNG format, just one last question.
Is keeping the same file format throughout the game any easier on the graphics cards or does it not really make a difference?
Thanks again!
-TorQue[MoD]
#10
the graphics cards never know what "format" the data was in they all look EXACTLY the same to the card.
as other people have stated above a JPEG, PNG and TGA that are all the same color depth end up being the EXACT same load on the graphics card because they are all end up being uncompressed and RAW byte data in the end.
01/13/2003 (7:42 am)
the file format is only for workflow and storage.the graphics cards never know what "format" the data was in they all look EXACTLY the same to the card.
as other people have stated above a JPEG, PNG and TGA that are all the same color depth end up being the EXACT same load on the graphics card because they are all end up being uncompressed and RAW byte data in the end.
#11
I don't know whatever came of it, but there were some legal issues raised over the use of *.gif and *.jpeg formats as standards on the web.
All I know is *.png is legally SAFE as well as superior for image quality.
01/13/2003 (7:59 am)
It also bears mentioning that PNG is a completely free format.I don't know whatever came of it, but there were some legal issues raised over the use of *.gif and *.jpeg formats as standards on the web.
All I know is *.png is legally SAFE as well as superior for image quality.
#12
A note on file size and compression:
I was poking around the docs on the Torque engine. The file system automatically supports zip files to store data. If you need to store data in a more compressed format, just zip them up. You will have to read the docs to understand how to use it, but the code is already there.
Frank
05/11/2004 (3:47 pm)
As far as I know jpeg can be used freely. You may want to look that up. GIF, however has patents associated with it. The algorithm the GIF format uses is called the LZW algorithm. This is patented. Although the US patent on the LZW algorithm just recently expired some time last year, other foreign patents have not. I was also under the impression that PNG was developed to provide similar features as the GIF format, but have no IP attached.A note on file size and compression:
I was poking around the docs on the Torque engine. The file system automatically supports zip files to store data. If you need to store data in a more compressed format, just zip them up. You will have to read the docs to understand how to use it, but the code is already there.
Frank
#13
05/14/2004 (1:59 pm)
I like PNG because you can have a choice 8 bit to 32 bit including 8 bit transparency embedded. But you can have fewer than 256 colours. some of my lightmaps are actually less and don't look any different. I actualy use both Jpg and PNG depending on what comes out smallest with the better quality like when trying to squeeze a demo down to 5mb or less :)
#14
PNG has the advantage of always being lossless. For things like normal maps, this can be very important as even high quality JPGs can introduce weird artifacts. JPG is always handy for things that don't need alpha channels or lossless quality when size is an issue.
05/14/2004 (2:40 pm)
A rather old thread ressurected.PNG has the advantage of always being lossless. For things like normal maps, this can be very important as even high quality JPGs can introduce weird artifacts. JPG is always handy for things that don't need alpha channels or lossless quality when size is an issue.
#15
05/14/2004 (2:57 pm)
We develop with PNG so that was always have a lossless version... for download considerations we have scripts that convert the PNG to 2 jpegs (color and alpha)
#16
Does Jpeg or PNG effect the loading time of the game?
Or does it have to do with howmany objects there are in de mission...
My loading time is about 22 sec but it would be nice to short it a little
03/11/2008 (3:48 am)
HelloDoes Jpeg or PNG effect the loading time of the game?
Or does it have to do with howmany objects there are in de mission...
My loading time is about 22 sec but it would be nice to short it a little
#17
If you're doing a single player type game.....
03/11/2008 (3:58 am)
www.garagegames.com/mg/forums/result.thread.php?qt=23589If you're doing a single player type game.....
#18
PNGs also support palettes, like GIFs. That means that if an image has less than 256 unique colours, it can be stored in 8-bit. For cartoon-style art where there are huge swaths of colour, PNG works very well.
03/14/2008 (10:37 am)
As long as the thread is resurrected:PNGs also support palettes, like GIFs. That means that if an image has less than 256 unique colours, it can be stored in 8-bit. For cartoon-style art where there are huge swaths of colour, PNG works very well.
Torque Owner Luc Jordan
But transparency too.