[cl-pdf-devel] cl-pdf image question

Cyrus Harmon ch-lisp at bobobeach.com
Wed May 9 17:43:32 UTC 2007


well, I see what might be an email client cut and paste error where  
unsigned-byte -> unsigned- byte, but other than that, yeah, it works  
for me. what's the error?

I've included the patch as an attachment.

Thanks,

Cyrus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cl-pdf-png-fix.patch
Type: application/octet-stream
Size: 1080 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-pdf-devel/attachments/20070509/1b13d796/attachment.obj>
-------------- next part --------------

On May 9, 2007, at 10:11 AM, Marc Battyani wrote:

> "Cyrus Harmon" <ch-lisp at bobobeach.com> wrote:
>
>> On May 9, 2007, at 12:15 AM, Marc Battyani wrote:
>>> What you do seems OK and it works when the image is converted to   
>>> jpg. So there is probably a problem with the png reading.
>>> Indeed (pdf::read-png-file "circles.png") gives a png-image with  
>>> 4  bytes.
>> Duh. Should have checked that I guess. Looks like we were only  
>> saving  the last chunk. The following patch fixes things.
>> Thanks again,
>> Cyrus
>> Index: png.lisp
>> ===================================================================
>> --- png.lisp (revision 139)
>> +++ png.lisp (working copy)
>> @@ -101,8 +101,15 @@
>>                                 (let ((position (position 0 trns)))
>>                                   (when position (list  
>> position))))))))
>>                ((string= marker "IDAT") ; image data block
>> -               (setq data (make-array octet-length :element-type   
>> '(unsigned-byte 8)))
>> -               (read-sequence data stream))
>> +               (let ((start 0))
>> +                 (if (null data)
>> +                     (setf data (make-array octet-length
>> +                                            :element-type  
>> '(unsigned- byte 8)
>> +                                            :adjustable t))
>> +                     (progn
>> +                       (setf start (first (array-dimensions data)))
>> +                       (adjust-array data (+ start octet-length))))
>> +                 (read-sequence data stream :start start)))
>>                ((string= marker "IEND")
>>                 (return))
>>                (t ;"pHYs"
>
> Thanks for the patch.
> Does it work for you? I tried your example with LW and got an error.
>
> Marc
>
>



More information about the cl-pdf-devel mailing list