Mantis - Squeak
Viewing Issue Advanced Details
325 Any feature always 10-10-04 15:14 03-02-06 09:27
none 3.9  
0000325: JPEG export on Macs broken
Author: Mark Guzdial
Date Posted: 23 August 2004
Archive ID: 23995
Comments: These are probably well-known, but just in case they're not:

- Squeak 3.6 on Macs cannot export JPEGs. Works fine in Windows, but
on Macs, it dies with a primitive failure.
 JPEGReadWriter2SmallImagesFix.1.cs [^] (2,617 bytes) 01-12-05 01:07

01-07-05 18:16   
Sounds like a VM issue. It works fine with a 3.7.4 VM and a 3.6-5429 image, so I consider this resolved.
01-08-05 00:11   
I'm not convinced:

StarMorph new imageForm writeJPEGfileNamed: 'StarMorph.jpeg'
Fails... saying buffer too short for compressed data

| fm |
fm _ Form fromUser.
fm writeJPEGfileNamed: 'afmprog.jpeg' progressive: true.
fm writeJPEGfileNamed: 'afm.jpeg' progressive: false.
but that works

This using Squeak on a G4 Mac
01-11-05 08:26   
jpeg export works on mac os9.1 vm3.8.5beta1 squeak3.9a-6548 at least it does for sketches i.e. screengrabs.
01-11-05 09:57   
I did not consciously "assign" this bug to myself (it's not something in which I have any expertise) but I can't seem to persuade Mantis to unassign it. If someone can figure out how to do that, please do, because this is not a bug in which I have any involvemen.

01-12-05 01:01   
for the example
StarMorph new imageForm writeJPEGfileNamed: 'StarMorph.jpeg'
we have a 28x28x32bit form. This by default creates a 784 byte ByteArray to store the results. However the resulting jpeg is 1013 bytes because the jpeg header needs some bytes, and the compression can't compress the image enough to store the data and the header information. Solution was to change
nextPutImage: aForm quality: quality progressiveJPEG: progressiveFlag and compress: aForm quality: quality to allocate an extra 1024 bytes of working storage. The result is trimmed to the actual size of the jpeg.
01-12-05 01:05   
StarMorph new imageForm writeJPEGfileNamed: 'StarMorph.jpeg'

causes error
01-12-05 01:20   
See [^]
A quick check shows creating a Form of 1x1 at 32bits requires 631 bytes of memory to store the header and the compressed bits
01-12-05 01:46   

Yep fails just as you say on Windows XP SP2 with 3.7gamma last update #5976.
The buffer looks like it has been filled properly but "byteCount" is 0


I got the same results on Linux with a 3.9a-6485 image. However I
should note that I haven't updated my VM in several months now.

01-12-05 17:08   
update 6549smallJPEGFix-JMM.cs
03-02-06 07:56   
Long since fixed.