Does the .png format suffice for all platforms?

BlitzMax Forums/BlitzMax Programming/Does the .png format suffice for all platforms?

JoJo(Posted 2005) [#1]
I'm wondering what format is good to use on all platforms without any trouble at all.

The reason I asked is because I developed a intranet web based application and the images where in bmp format.
When I used the IE browser on the mac and opened my page, the bmp images didn't load. It worked fine when using a pc.

Is this because you can't use bitmap images on the mac or what?


xlsior(Posted 2005) [#2]
I'm pretty sure all webbrowsers support PNG...

At least you'll find better support than .BMP does... Don't think all of the Linux browsers support .BMP either, and I know those will do PNG.


N(Posted 2005) [#3]
PNG is God.


Perturbatio(Posted 2005) [#4]
There can be problems with colours and PNG I've noticed, or at least with the way some browsers render them. They can appear slightly darker than they should be.


N(Posted 2005) [#5]
That's because some browsers aren't standards compliant (<cough>Internet Explorer</cough>).


Perturbatio(Posted 2005) [#6]
yes, but because IE is the main browser for windows users, you need to take that into account.

JPEG and GIF will be fine for all platforms.


FlameDuck(Posted 2005) [#7]
I'm pretty sure all webbrowsers support PNG.
Internet Explorer 6 does not display transparent (alphaed) PNG images properly. Internet Explorer 5 does tho'.


Zenith(Posted 2005) [#8]
IE is not the main browser for any smart Windows user. I guess that is only half(one fourth, haha) the Windows users?

Infact, I've been trying to totally wipe IE off my XP computer and laptop! :P


xlsior(Posted 2005) [#9]
Internet Explorer 6 does not display transparent (alphaed) PNG images properly. Internet Explorer 5 does tho'.


True, but since his intent is on replacing existing .BMP images, that shouldn't be an issue since BMP doesn't support any transparancy.


Beaker(Posted 2005) [#10]
Also, he isn't using images in a browser, so that is irrelevant.


Perturbatio(Posted 2005) [#11]
Also, he isn't using images in a browser, so that is irrelevant.


ummm...
When I used the IE browser on the mac and opened my page, the bmp images didn't load. It worked fine when using a pc.



JoJo(Posted 2005) [#12]
Thanks for the replies but I didn't communicate my question very well.
I wanted to know what format would be good on all platforms if I wanted to create a game and release it on all three platforms.

I just mentioned the intranet app because I ranned into that problem and wondered if what formats would be universal to all three platforms and which ones are not.

So it looks like a developer would be safe if they stuck with .PNG, GIF, and JPG.


xlsior(Posted 2005) [#13]
I wanted to know what format would be good on all platforms if I wanted to create a game and release it on all three platforms. I just mentioned the

...

So it looks like a developer would be safe if they stuck with .PNG, GIF, and JPG.



OK, that's an entirely different issue again, it sounded like you were asking about web compatibility, but you're not.

Whether or not you can develop programs or games with certain image files depends entirely on the language you're doing it in.

In the case of BlitzMax, it supports the same image formats on all the supported platforms: You can use PNG, JPG, BMP and TGA in your programs on Windows, Linux and the Mac. Whether or not a webbrowser on the Mac is incapable of rendering .BMP has nothing to do with it: BlitzMax comes with its own built-in BMP rendering module.

BlitzMax does NOT have built-in support for .GIF, so unless you write your own decoder module for .GIF you won't be able to use those.

As far as which format to use, depends on several factors:

1) JPG is great for 'photographic' information. Full color photo's, complicated backgrounds, etc. can compress very well with JPG. JPG is a so-called 'lossy' compression algorithm, and it will discard some color information and crispness (how much depends on the compression ratio you picked). It will be able to get the smallest file sizes by far, but is not suitable for all types of images since they can introduce a lot of noise in images that do not use a great many different colors.

2) PNG uses lossless compression, meaning that no information gets lost during compression, and the exact original information will be displayed, unlike JPG. File sizes will be larger than the same image in JPG, will the quality can be significantly better. Another major advantage of PNG is that it contains alpha-information (transparancy), so it is great for things like sprites: unlike normal masked sprites, with alpha blending you can use gradations of transparancy: smooth edges around a sprite, half-transparent windows, etc.

3) TGA and BMP are more legacy file formats, and of lesser use. They too are lossless file formats like PNG, but their compression tends to be a little lower, and they do not support an alpha channel as far as I know.

For game programming I would personally stick to PNG and JPG... In the game I'm working on right now, the overall backgrounds are all done with JPG, but I'm using PNG's for all the sprites.

(In my case, a particular 800x600 backdrop screen was 112KB as a JPG, or 580KB as a PNG. Since there was little visual difference between the two, simply using the JPG instead of the PNG there cut 468KB off the final size of my EXE.)


JoJo(Posted 2005) [#14]
Thanks xlsior! Thats was the explanation I was looking for.

@Everyone else:
Sorry about the miscommunication.


Dreamora(Posted 2005) [#15]
Beside that: Size of image is irrelevant anyway after loading as they have exactly the same size in graphics ram ( length x width x depth )


Beaker(Posted 2005) [#16]
Both TGA and BMP support alpha.


Cajun17(Posted 2005) [#17]
BMP isn't compressed that's why it's so big and it must be a 32bit image to suppost alpha. MSPaint will squash the alpha of an image loaded into it because it only supposrts 24-bit images.


xlsior(Posted 2005) [#18]
BMP does have compression, but it's optional... It can use RLE (Runtime Length Encoding), which isn't very efficient.


Russell(Posted 2005) [#19]
Don't most images keep their alpha information in the '4th byte' of the bit plane (bit 25-32)?

Russell

p.s. JPEG2000 supposedly has the benefits of PNG, with the file size of JPEG... ( http://www.jpeg2000info.com/ ). Unfortunately, it doesn't appear to be free :(