[cl-gd-devel] PNG compression

Hans Hübner hans at huebner.org
Wed Oct 1 23:24:36 UTC 2008


Works for me:

GD-TEST> (with-open-file (f "/tmp/test.png")
           (file-length f))
3005915
GD-TEST> (with-image* (1000 1000 t)
           (write-image-to-file "/tmp/test.png" :compression-level 1
:if-exists :supersede))
#S(CL-GD::IMAGE :IMG #<A Foreign Pointer #x58E000>)
GD-TEST> (with-open-file (f "/tmp/test.png")
           (file-length f))
13178
GD-TEST> (with-image* (1000 1000 t)
           (write-image-to-file "/tmp/test.png" :compression-level 9
:if-exists :supersede))
#S(CL-GD::IMAGE :IMG #<A Foreign Pointer #x58E000>)
GD-TEST> (with-open-file (f "/tmp/test.png")
           (file-length f))
2987

FreeBSD, cl-gd 0.5.6, gd-2.0.35

What are your results for this test?

-Hans

2008/10/1 Andrei Stebakov <lispercat at gmail.com>:
> On the site http://www.libgd.org/GdHistory they say:
> That "the PNG compression level can now be specified when writing PNG
> images. See the new gdImagePngEx, gdImagePngEx, gdImagePngCtxEx, and
> gdImagePngPtrEx functions.".
> This feature starts from version 2.0.12.
> I have 2.0.35, so yes, libgd should support it.
>
> Thank you,
> Andrew
>
> On Wed, Oct 1, 2008 at 6:53 PM, Hans Hübner <hans at huebner.org> wrote:
>>
>> 2008/10/1 Andrei Stebakov <lispercat at gmail.com>:
>> > I was experimenting with write-png-to-stream trying :compression-level
>> > from
>> > -1 to 9 but it doesn't change the size of the image.
>> > For jpeg quality level works though.
>> > What can I check for PNG compression to work?
>>
>> Are you sure that libgd supports compressing PNGs?  If so, it may be a
>> fixable API problem.  Please verify that libgd itself supports
>> compression, then let us know.
>>
>> Thanks,
>> Hans
>> _______________________________________________
>> cl-gd-devel site list
>> cl-gd-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/cl-gd-devel
>
>
> _______________________________________________
> cl-gd-devel site list
> cl-gd-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-gd-devel
>



More information about the Cl-gd-devel mailing list