PNG vs GIF performance

Hi all,

Is there any performance hit by implementing PNG images as sprites instead of GIFs? Also, would the same be true when using JOGL or other OpenGL bindings?

Regards,

ribot.

[edit: added OpenGL question]

It’ll depend on the format for the images - gifs can have 1-bit transparency and can be created as managed images. They’re about as fast as sprite drawing can be. However pngs can contain a full 8 bit transparency values and drawing those is pretty damn slow. I think you should be able to create 1-bit transparent pngs and get the same speed as a gif, but you’ll have be to careful with the image creation.

On the other hand, if you use LWJGL or Jogl, then drawing images with full alpha channels is lightning fast, and lets you have rotation/scale/recolouring for free as well. ;D

Thanks OT!

I intend to move from Java2D for drawing onto LWJGL in the next week, I just wanted to spend some time creating a simple project, where i can compare its performance between rendering modes… Hopefully, the speed will really stand out in the OpenGL based versions.

:slight_smile:

Regards,

ribot