PNG image size?

BlitzPlus Forums/BlitzPlus Programming/PNG image size?

Regular K(Posted 2005) [#1]
Im wondering if its possible to find out the size (width and height) of a PNG image without having to load it. Right now, im loading the images and then calculating how many frames the image has (width/32), after that I load the image as animated.

Right now that doesn't pose a problem, as Im only doing that for 5 images, but once I have more, it may slow down.

So, anyone know of a way I can quickly extract the size of the image? Im gonna try to find out the structure of PNGs a bit.

EDIT: Doing some tests, and I found a pattern, it appears (possibly just luck) that width is kept on byte 20?


WolRon(Posted 2005) [#2]
Isn't this in the code archives?

http://www.blitzbasic.com/codearcs/codearcs.php?code=1492#comments


Regular K(Posted 2005) [#3]
Id never think of looking a solution done in code made in Blitzmax.

Well, thanks, Ill have to get to work on translating this to BlitzPlus.