PNG libraries

Stewart Gordon smjg_1998 at yahoo.com
Wed Sep 12 17:20:31 PDT 2007


"Lutger" <lutger.blijdestijn at gmail.com> wrote in message 
news:fc9ii8$25jf$1 at digitalmars.com...
> Stewart Gordon wrote:
<snip>
>> But to allow the user to manipulate the range of public ancillary chunks 
>> available, there's the added complication of chunk ordering rules to 
>> consider, at least if we want to protect the user against inadvertently 
>> creating a PNG file that's invalid because the chunks are in the wrong 
>> order.
>
> This is not a problem since the Chunk type implements opCmp by which an 
> array of chunks can be sorted in the right order.

Well, at the moment it seems both buggy and unused - so here's already 
something to look at.

Still, the ordering rules in the PNG spec don't produce a total ordering 
relation.  Still,  "must come before" and "must come after" are relations we 
can implement (which I'm guessing is what you intended to do in Chunk.opCmp) 
and would probably be sufficient.

<snip>
> What could be done is making a low-level interface for getting and saving 
> chunks, along with some utility routines (most are already there) which 
> allow the user to filter / (de)compress / convert / deinterlace / etc. in 
> a controlled manner.

That's more or less how my library would work were I to write it.

<snip>
> Implementing streaming / progressive display and saving interlaced images 
> will complicate matters though, not sure if that would fit in. Conversion 
> to anything else than 8 bits per color channel is also not implemented, 
> but would not be much work.

Streaming and progressive display are among the things I'd like to support 
in my library.

Of course, improving Lodepng and writing a new library from scratch needn't 
be mutually exclusive.  Lodepng can be improved to do more within its design 
constraints, while writing a new PNG library is something that could be 
undertaken as a larger project given the time.

> Here is a link to the source, lodepng is in scrapple: 
> http://www.dsource.org/projects/scrapple/browser/trunk/lodepng/lodepng

Yes, I've found that already.

> Perhaps we should take further discussion to email or at the scrapple 
> forum at dsource?

We could continue the discussion on dsource if you like.

Stewart. 




More information about the Digitalmars-d mailing list