Page 1 of 1
Which is best : PNG or JPG ?
Posted: 15.10.2005, 02:44
by Cham
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 ?
Posted: 15.10.2005, 05:10
by Don. Edwards
PNG of course.
Posted: 15.10.2005, 05:14
by Cham
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 ?
Posted: 15.10.2005, 08:39
by Don. Edwards
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.
Posted: 15.10.2005, 09:26
by Malenfant
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.
Posted: 15.10.2005, 12:50
by Vincent
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.
Posted: 15.10.2005, 21:24
by Harry
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
Posted: 15.10.2005, 22:33
by Don. Edwards
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.
Posted: 15.10.2005, 22:36
by Cham
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.
re
Posted: 25.10.2005, 06:22
by John Van Vliet
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