Which is best : PNG or JPG ?

Tips for creating and manipulating planet textures for Celestia.
Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Which is best : PNG or JPG ?

Post #1by Cham » 15.10.2005, 02:44

I want all my planet and moon textures to be of highest quality (no loss in compression), in 2k format, but I also want the best efficiency in speed and FPS in Celestia. So which format is better for Celestia, JPG at the highest settings or PNG ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Don. Edwards
Posts: 1510
Joined: 07.09.2002
Age: 59
With us: 22 years 2 months
Location: Albany, Oregon

Post #2by Don. Edwards » 15.10.2005, 05:10

PNG of course. :D
I am officially a retired member.
I might answer a PM or a post if its relevant to something.

Ah, never say never!!
Past texture releases, Hmm let me think about it

Thanks for your understanding.

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #3by Cham » 15.10.2005, 05:14

Please Don, can you tell why ?

I know there's no quality loss with PNG , and there may be some losses with JPG even at the highest quality, but what else, about speed and FPS efficiency ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Don. Edwards
Posts: 1510
Joined: 07.09.2002
Age: 59
With us: 22 years 2 months
Location: Albany, Oregon

Post #4by Don. Edwards » 15.10.2005, 08:39

the compression method used on JPG images is like what it done to music when compressed to MP3. Certain sound frequencies are removed during hte compression process. This is why JPGs often look blocky and pixelated, This is called a lossy format. PNG however uses a diferent way of compressing the image, It retains most of its clarity and quality. There is usualy no pixelated effect as well. The file for a PNG with be largere than that of a JPG. But what you get in image quality makes up for the difference. Also PNG has the ability to retain an alpja chanel, This is the chanel that allows for tranparency in the image, such as cloud textures. JPG has no alpha chanel. JPG2000 does but it not widely used and is not compatible with Celestia and many other image editors without a plug-in.
I hope this helps more. I am sure seldon, fridger or several others could go into much further detial. But this get the main point across.

Don.
I am officially a retired member.
I might answer a PM or a post if its relevant to something.

Ah, never say never!!
Past texture releases, Hmm let me think about it

Thanks for your understanding.

Malenfant
Posts: 1412
Joined: 24.08.2005
With us: 19 years 3 months

Post #5by Malenfant » 15.10.2005, 09:26

Don. Edwards wrote:the compression method used on JPG images is like what it done to music when compressed to MP3. Certain sound frequencies are removed during hte compression process. This is why JPGs often look blocky and pixelated, This is called a lossy format.


I don't think that's quite technically correct actually. AFAIK, MP3 compression just clips off the higher frequencies. JPG compression on the other hand basically averages things out around each given pixel.

What JPG does is flatten out areas with a similar pixel value. Let's say you have an 8-bit greyscale image of a crater floor (so the pixel numbers - aka data numbers or DNs - are on a greyscale of 0 to 255). If the DNs range randomly between say 50 to 60 in one area and you apply a high JPG compression to that, then it'd turn that area into a few large blocks of a single averaged DN. It basically takes an average value using the surrounding pixels if the DNs are roughly in the same ballpark as eachother - the higher the compression, the lower the resolution of the averaging, and the more big, ugly compression blocks you'll see. (NASA images use a similar kind of compression - you can really see this badly on some Galileo images).



You're right about PNG though, it is lossless compression (I believe GIF is lossless too, assuming you have 256 colours or less. If you have more, then you'll lose colour data because the colours will be squished to fit into a 256 colour palette). I think TIF LZW compression is lossless too, though I have no idea how PNG or TIF compression works while remaining lossless - they're a bit of a magic black box to me.

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #6by Vincent » 15.10.2005, 12:50

I know there's no quality loss with PNG , and there may be some losses with JPG even at the highest quality, but what else, about speed and FPS efficiency ?


Celestia has to decompress JPG textures before they can be used by your graphics card. That requires significant amount of CPU time.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Post #7by Harry » 15.10.2005, 21:24

Malenfant wrote:I don't think that's quite technically correct actually. AFAIK, MP3 compression just clips off the higher frequencies.
MP3 is much more complicated than that. Many different frequency ranges are removed, depending on which of the frequencies a human listener is (likely) able to hear.
JPG compression on the other hand basically averages things out around each given pixel.
Again, the method is more complicated and does have some similarities to MP3 (though AFAIK MP3 is more complex).
What JPG does is flatten out areas with a similar pixel value. Let's say you have an 8-bit greyscale image of a crater floor (so the pixel numbers - aka data numbers or DNs - are on a greyscale of 0 to 255). If the DNs range randomly between say 50 to 60 in one area and you apply a high JPG compression to that, then it'd turn that area into a few large blocks of a single averaged DN. ...

That wouldn't explain the type of artifacts you see on b/w borders (e.g. text) with low-quality compression.

Regarding performance: both PNG and JPG have to be decompressed by the CPU, which usually takes a lot more time than simply loading the data from HD (as for DDS). Both should have similar performance, but in some simple tests PNGs often loaded a tiny bit slower. PNG certainly does have the better quality However it should be nearly impossible to tell a difference unless the JPGs are edited again, and JPG is much friendlier for downloading and keeping on HD. And you should keep in mind that often the source material wasn't perfect either.

Harald

Don. Edwards
Posts: 1510
Joined: 07.09.2002
Age: 59
With us: 22 years 2 months
Location: Albany, Oregon

Post #8by Don. Edwards » 15.10.2005, 22:33

Well I knew someone would come in and answer it better than i did. I was simply trying to use and MP3 as an example, not a very good one mind you. Another lossless format is TGA, and of course BMP. Both create fairly large files of course.

Hope this has helped more than confused you Cham!

Don.
I am officially a retired member.
I might answer a PM or a post if its relevant to something.

Ah, never say never!!
Past texture releases, Hmm let me think about it

Thanks for your understanding.

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #9by Cham » 15.10.2005, 22:36

Thanks to you guys, for you replies.

So I'll continue to use JPG at the highest settings. That's what I wanted in the first place, but recently I had some weird experiences on my system which puzzled me. Now it's solved.

Thanks again.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
John Van Vliet
Posts: 2944
Joined: 28.08.2002
With us: 22 years 2 months

re

Post #10by John Van Vliet » 25.10.2005, 06:22

for the best speed with .png's i use image magick to re save the hole folder ( medres and hires) to level1 compresion it will take up A LOT more space but will load faster


Return to “Textures”