writing jpegs failure, a bit of help needed

Lukas Renggli renggli at gmail.com
Wed Jan 12 15:17:34 UTC 2005


We observed the same problem and we came to the following conclusion:
Squeak assumes that the compressed JPEG is always of a smaller or
equal size than the height times the width of the original bitmap.
Therefor it allocates a buffer that is too small in certain cases,
especially small bitmaps are usually bigger than this guess. In those
rare cases the primitive raises an error, because of the buffer being
too small.

An ugly fix to this problem can be obtained by modifying the buffer
allocation in JPEGReadWriter2>>compress:quality: Replace the line

	buffer := ByteArray new: sourceForm width * sourceForm height.

with something like

	buffer := ByteArray new: 2 * sourceForm width * sourceForm height.

But this is definitely not a fix that solves this problem properly :-(

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch



More information about the Squeak-dev mailing list