Closed Bug 505762 Opened 16 years ago Closed 16 years ago

(maybe) need a better way to get png width/height from libpng

Categories

(Core :: Graphics: ImageLib, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bholley, Unassigned)

Details

In bug 435296, we want to get only the width/height from a png with the lowest possible amount of overhead. Currently, I don't see any way in the libpng api to do this without doing more serious initialization of the png read structure. My impression is that this is more expensive than it needs to be, since it fires up all the z decompression stuff which shouldn't be necessary to read headers. As a result, the current hack I've implemented involves using setjmp/longjmp (grep for the word 'gross' in the patch over at bug 435296). Glenn - a few questions: 1) Am I correct that there's way with the current png API to get the width/height without full read struct initialization? 2) How significant would you estimate the overhead of this to be? 3) Depending on the answers of 1 and 2, would it be possible to put support into libpng for easier access to the header data?
If all you want is the width and height, you should be looking at the *NIX "file" utility. The width and height are in known offsets from the beginning of the datastream, as 4-byte integers in network byte order (most significant byte first). You don't need libpng for that.
per glenn's advice I hand-rolled my own code over at bug 435296 and it works great. Resolving this as invalid.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.