[squeak-dev] Re: quick handling of graphics files

Andreas Raab andreas.raab at gmx.de
Wed Apr 14 04:05:12 UTC 2010

Hi Ross -

Profiling is your friend. In most cases, 95% of the time are spent in 5% 
of the code. From what you're saying below it sounds that you're using 
one of the 'special' PNG modes (black and white, or gray-scale) that 
probably have seen less attention for optimization than others. Any 
chance you can post a sample image for profiling it?

   - Andreas

On 4/13/2010 6:37 PM, Ross Boylan wrote:
> I have PNG files with document scans, and would like to view them as
> part of an application.  I will also need to scale and/or pan them.
> One file took over a minute to open when I selected "open graphic in
> window" from the file browser.  (ImageReadWriter formFromFileNamed:
> 'myfile.png') asMorph openInHand had about the same speed.
> I'm looking for advice on how to speed that up, or the information that
> is not possible.  I found a similar question on the newbie list, but no
> one answered it.
> I'm guessing that it is the initial read and translation of the file
> that's taking the time, since resizing the image is much faster than
> loading it.
> This is really too slow to be practical, and much slower than
> imagemagick's display command, which opens in under 5 seconds.
> The image is a 400dpi black and white scan of an 8.5x11" page; the file
> is 144k bytes.
> BTW is there any particular reason the file browser opens a SketchMorph
> while asMorph on the ImageReadWrite result produces an ImageMorph?  The
> former is closer to what I want since it is resizeable and not
> transluscent; on the other hand, the comment in SketchMorph says they
> are produced by the PaintBox, which is not true in this case.
> Squeak 3.10.2 on Linux with 32 bit color in X.  I think squeak is using
> 32 bit color as well, but couldn't find the setting on a quick look (not
> in preferences browser).

More information about the Squeak-dev mailing list