ZLib streams

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ZLib streams

Steven Kelly
On a related note:

I've been using John Brant's excellent PNGImageWriter
(http://www.refactory.com/Software/PNG.zip), which uses his
ZLibInterface (http://www.refactory.com/Software/ZLibInterface.zip) to
the zlib library, either as a separate DLL or as part of the VM. A
customer recently found that this occasionally produced invalid PNG
files, and my own tests confirmed a little over 1% of files failing.
Switching from the zlib code to the contributed\Compression parcel from
Squeak solved the problem, but is around 10x slower.

VW's own parcel, Compression-ZLib, oddly contains only GZip streams: no
ZLib. By a little reverse engineering of these various parcels and
trying to understand the PNG and zlib specs, I managed to make my own
ZLibWriteStream. It fits in the hierarchy of Compression-ZLib, uses the
VM's internal zlib, and successfully produced PNGs from 2000 images
without error (including the ones that failed earlier). It's almost
certainly wrong in some aspects, but if someone at Cincom felt like
adding ZLib streams to Compression-ZLib (hint! :->), it may at least
help you get started!

All the best,
Steve

PS I of course place the package in the public domain, and take no
responsibility for it. Do not use PNGs saved with this to run a nuclear
facility.

PPS I imagine you should delete #compressionLevel and #flush, and
consider moving the code in #on: to #writeHeader, and the latter part of
#writeBuffer: to #finishOutput. I haven't tested this though.

Martin Kobetic [[hidden email]] wrote:

> For reading zip files, there's now Compression-Zip package in
> the public repository which will also ship with VW7.6. For
> details, take a look at the package comment.
>
> HTH,
>
> Martin
>
> Jim Guo wrote:
> > hi,
> > VW can't handle zip and rar files so I google to find that
> winrar has
> > provided a freeware unrar as dlls at:
> http://www.rarlab.com/rar_add.htm.
> > Any wrappers in VW
> existing there, please?
> > Thanks!
> >
> > Best Regards,
> >
> > Jim G
>
>

Compression-ZLibWrite.st (3K) Download Attachment