Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Compressing image data (bugs?)

From: henrik::webz::dk at: 4-Dec-2003 14:57

Hi, all Sometimes image handling baffles me a bit. I want to embed a small 2-colored image in the script for use in a button. It would of course be nice to compress it to a chunk of binary data. However, I always lose the size of the image when doing something with it, which is highly impractical. If I have:
>> img: make image! [16x14 #{
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF... etc. or
>> img: load %image.gif
and:
>> to-image decompress compress img
the size is lost, but the binary information remains. So in order to keep size information, I would have to:
>> img-data: to-binary decompress #{
789CAD90410A003008C3FCFFA7DD6583516CD5CDDC94A688EE1CDB8888E4C5BF F3E8675D515ECD915BF1B1C3808A7FF6B8EBF88C8EFF7BFFC4FFB23C9B5987F2 959BDDD3A5E22F920B1DFF80030000 }
>> img2: make image! [16x14 img-data]
But, img2 contains just 2 bytes set, and they are random, for each time I set img2 by the above line. The remaining bytes are zero. It looks like a bug? But:
>> length? img2
gives the correct length though. BTW: Just found by playing around that:
>> to-image to-binary img
Crashes Rebol 1.2.10.3.1, but runs perfectly in 1.2.1.3.1 Regards, Henrik Mikael Kristensen