JPG vs PNG

Just starting out? Need help? Post your questions and find answers here.
embrance
User
User
Posts: 37
Joined: Mon Sep 01, 2003 4:22 am

JPG vs PNG

Post by embrance »

For games use,is jpg better thaN PNG?PNG IS SMALLER,and jpg bigger.
wich is the best chooice?
:?:
couse for an animation i made i used 35 frames*15kb(jpg)=1+mbs
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

What you wrote is not realy true.

PNG is a graphic compression which does not lose and datas. That means, if you convert a BMP to a PNG it is exactly the same.

JPG reduces the data amount like mp3 with audiofiles. So afer converting a BMP to and JPG this is not the same picture anymore.

Both shemas are totaly different. But for games JPG should be enough.

Cheers
Mike
Tranquil
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Re: JPG vs PNG

Post by freedimension »

embrance wrote:For games use,is jpg better thaN PNG?PNG IS SMALLER,and jpg bigger.
You have to show me that, else I won't believe you.
JPG uses a lossy compression and hence produces much smaller files than PNG (OK, it may depend on the settings and the color depth).

There would be no need for two graphics formats if one is always better than the other. I.e. it depends on what you are needing them for.
For sprites with a small amount of colors PNG is almost everytime the better choice. For true color Pictures like Photos or Renderings JPG does the job.
Do you have one color that is supposed to be transparent (once more for sprites) you have to use PNG because JPG produces some background noise that can't be filtered with such a simple method.

Read a primer on PNG and on JPG for further information.

kind regards
freedimension
embrance
User
User
Posts: 37
Joined: Mon Sep 01, 2003 4:22 am

3D game studio pro

Post by embrance »

i tested a 500x500 pics/I drawed some stufff so here are the results:
200kbs+ BMP format :evil:
6 kbs PNG format 8O
11 kbs jpg format
:cry:
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

With JPG, what compression rate have you used? Try it once more with 20-50%.
It also depends on what you've drawn. How many colors does your image has? Are there large areas of the same color? And so on, and so on.
embrance
User
User
Posts: 37
Joined: Mon Sep 01, 2003 4:22 am

50posts!finally!

Post by embrance »

ok.You are right.
However by loading about 500-1800 jpg giles around 5-10 kb each wouldnt require lots of memory?
Is there a wany to avoid this thing?
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Re: 50posts!finally!

Post by LarsG »

embrance wrote:ok.You are right.
However by loading about 500-1800 jpg giles around 5-10 kb each wouldnt require lots of memory?
Is there a wany to avoid this thing?
8O

You've got to load and free images as you go...

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
embrance
User
User
Posts: 37
Joined: Mon Sep 01, 2003 4:22 am

A very good&cheap greek web hosting company:]

Post by embrance »

yes i know that fact.BUT if i load them all at the beggining wont i get better speed when there will be tons of stuff in the screen? :?:
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Re: 50posts!finally!

Post by freedimension »

embrance wrote:ok.You are right.
However by loading about 500-1800 jpg giles around 5-10 kb each wouldnt require lots of memory?
Is there a wany to avoid this thing?
Whether you load a JPG or a PNG doesn't matter, they are both the same size once they are in the RAM. Compression only matters while they are on the harddisk, keep that in mind.
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Re: A very good&cheap greek web hosting company:]

Post by LarsG »

embrance wrote:yes i know that fact.BUT if i load them all at the beggining wont i get better speed when there will be tons of stuff in the screen? :?:
Yes, you would get better speed.. it's a kind of "no-no" to load stuff during gameplay (or whatever you're doing)..
But you can't load that many images into memory all at once... Lot's of pc's will choke... Just try adding the size of the files in .bmp and calculate how much memory it will eat up...

What you need to do, is make a loading routine between levels or screens (or whatever you're doing).. That way you're only having the currently used images loaded in memory, and the rest is free'd up... The speed will remain the same...

-Lars

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
embrance
User
User
Posts: 37
Joined: Mon Sep 01, 2003 4:22 am

50posts!finally!

Post by embrance »

Wel i was thinking to load the basic tuff like decoration at the beggining and the other during battle etc.However thnx for your suggestion.I will follow it:] :D
User avatar
griz
Enthusiast
Enthusiast
Posts: 167
Joined: Sun Jun 29, 2003 7:32 pm
Location: Canada

Post by griz »

PNGs :

Pros :
- great for images containing large areas of the same color
- image integrity/quality maintained at 100%

Cons :
- complex images like photographs do not compress well

JPGs :

Pros :
- great for complex images like photographs

Cons :
- image quality is directly reduced with increased compression
- creates image noise unsuitable for transparent sprite masks as freedimension pointed out

I do not see PNG competing with JPG at all. They co-exist perfectly and should be chosen based on the exact requirements of your project. An image ideally suited to JPG may look/compress worse as a PNG and vice versa.
kenet
User
User
Posts: 24
Joined: Wed Apr 30, 2003 5:44 pm
Contact:

Post by kenet »

Png include also an alpha channel...
that doesnt help much
Post Reply