png or jpg ???

BlitzMax Forums/BlitzMax Beginners Area/png or jpg ???

Blitzplotter(Posted 2007) [#1]
I've developed a menu sysytem with png graphics.... but they seem a bit pixelated - I am tempted to try implementing jpeg buttons instead - pros/ cons anybody ? Thanks - BP.


sswift(Posted 2007) [#2]
Jpeg doesn't support transparency, so unless you want to have two images, or all your menu things are square, you should use PNG.

PNG isn't any more pixelated than jpeg anyway unless you've done something to them to make them that way. Like making them lower res or reducing the colors too much.


ImaginaryHuman(Posted 2007) [#3]
I agree, jpeg will give you even less quality and fewer options. Maybe show us a screenshot of what the pixellation looks like.


GfK(Posted 2007) [#4]
If you're having problems with pixellation then your images are either too small, and/or you are using maskblend instead of alphablend.

Whichever, changing to JPG is only going to make it worse.


Blitzplotter(Posted 2007) [#5]
Yes, I'm running a full screen at 800 by 600, I've scaled my buttons up to 70 by 70 pixels (from 44 by 44 @ 72 dpi) with an increase from 72 dpi to 144dpi in Ifranview.

I've created the buttons first in MSoft Pictur it -- initiallthe images are Huge.... I'm scaling them down using Irfanview.

I presume theres no drawback to ramping up the dpi to say.... 288 dpi (or more ?) as long as your not going to be printing the images?

Thanks for the replies.


GfK(Posted 2007) [#6]
70x70 images will get scaled up to 128x128 internally. 44x44 will become 64x64. This might explain the pixellation you're experiencing.

Forget DPI. Doesn't make any difference unless you're printing images. All that matters is image width and height.


bradford6(Posted 2007) [#7]
2 tips that might help:

1. (as GFK said) use only power of 2 textures (64x64 - 128x128 - etc..)

2. if you plan on rotating the images, pad the edges with 2 or 3 pixels of blank space.


Grey Alien(Posted 2007) [#8]
png for sprites, logos etc. jpg for full screens images.


xlsior(Posted 2007) [#9]
Upscaling *any* image will make it look more pixelated. If anything, JPG will add compression artifacts on top of that.

For best results, use graphics that are either native sized, or the biggest resolution you'd need and scale them down for the lower resolutions, rather than the other way around.


Boulderdash(Posted 2007) [#10]
BMP - No compression.
PNG - 256 COLOUR , loss-less compression.
JPEG - True COLOUR , lossy compression.


Gabriel(Posted 2007) [#11]
PNG - 256 COLOUR , loss-less compression.

No, that's wrong. PNG can have all sorts of levels of color, including the most common, 32 bit.


Grey Alien(Posted 2007) [#12]
yep png is 32 bit tht's 24 bit colour and 8 bit transparency.


impixi(Posted 2007) [#13]
I think Gav was confusing PNG with GIF (original spec). That format was 256 colour, loss-less.


ImaginaryHuman(Posted 2007) [#14]
I thought perhaps that actually PNG can do up to 16 bits per color channel, meaning it supports 64 bit truecolor? Or maybe I am thinking of something else.

You might possibly find also that some jpeg loaders apply `smoothing` which possibly might make the buttons look more smoothed out and blurred which gives an impression that they are not so `pixellated`, as if the png buttons had been `sharpened`. ?


Gabriel(Posted 2007) [#15]
I thought perhaps that actually PNG can do up to 16 bits per color channel, meaning it supports 64 bit truecolor? Or maybe I am thinking of something else.


It rings a bell, but I think it might be an unofficial "branch" of the PNG format, rather than something officially recognised by the PNG Development Group.

Incidentally, I don't think Gav was confused nor indeed was he strictly wrong. There is a 256 color 1 bit alpha version of the PNG format, it's just not the only one.


JohnK(Posted 2007) [#16]
I think that PNG is better choise...


MikeT(Posted 2007) [#17]
I tend to use png's more than jpg's. But that is just my preference


H&K(Posted 2007) [#18]
If you save them both as zero compression. (Well 100 Quality for Jpeg and 0 Compression for Png), are they then of the same quality?


ImaginaryHuman(Posted 2007) [#19]
You can compress the PNG at no compression or at absolute highest compression it will not change the image quality.

A jpeg at `100%` quality still loses some quality but it might not be enough to be noticeable unless you compare the two alongside each other.