Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Thumbnail
Last updated at 1:50 pm UTC on 29 October 2019
 SketchMorph subclass: #Thumbnail
	instanceVariableNames: 'maximumWidth minimumHeight'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'MorphicExtras-PartsBin'

A morph that serves as a thumbnail of a given form.


Example 0:
 aPoint := 320 @ 230.
 (Thumbnail new maxWidth: aPoint x minHeight: aPoint y)
     makeThumbnailFromForm: aForm


Example 1: Create a thumbnail of the desktop (world PasteUpMorph object):

 ((Thumbnail new maxWidth: 200 minHeight: 120) 
 makeThumbnailFromForm: World imageForm)
 openInWorld

Example 2: Create a thumbnail from a Windows BMP bitmap graphics file:

 ((Thumbnail new maxWidth: 240 minHeight: 150) 
 makeThumbnailFromForm:
 (Form fromBMPFileNamed: 'E:\Paint\bitmaps\Garten.bmp'))
 openInWorld

Example 3: Create a thumbnail from a JPG file:

 ((Thumbnail new maxWidth: 400 minHeight: 250) 
 makeThumbnailFromForm:
 (Form fromFileNamed: 'E:\Paint\scan\Baeume.jpg'))
 openInWorld

The message #fromFileNamed: works for BMP and PNG files as well.


Example: How to resize project thumbnail windows

Note

There is also ThumbnailMorph

See also

Scaling images