Supported Image File Formats/en

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen

The underlying runtime framework supports the most common bitmap/image formats: GIF, JPEG, PNG, TIFF, BMP, XPM and a few other less common formats.

Other Formats[Bearbeiten]

Support for other formats, which are more or less of historic interest, can be made available upon request and at some extra charge: XWD, Targa, Sun-Raster, PICT, PCX, PBM, OSX-Icon, IrisRGB. Also, subset of the AVI and FLI formats can be provided if there is a need.

Image Reading[Bearbeiten]

Elementary code can access readers as subclasses of ImageReader (a slightly missleading name - most of them can write image files as well). To read an an image, use one of:

<readerClass> fromFile: 'someFilename'
<readerClass> fromStream: aReadStream
<readerClass> fromBase64Stream: aReadStream
<readerClass> fromBytes: aByteCollection
<readerClass> fromURL: 'aURL'

If one of those messages is sent to the common superclass "ImageReader", it will try to determine the format (from the file extension and/or the first few header bytes in the data.

IF it is sent to a concrete reader class (GIFReader, JPEGReader, TIFFReader, PNReader etc..) the format should match the readers expectations. You get a list of existing readers via "ImageReader allSubclasses" or by opening a System Browser ("Extras" → "Tools" → "Class Browser")

Image Writing[Bearbeiten]

An image can be saved in a file or sent to a stream in one of the supported formats with:

<readerClass> save: anImage onFile: 'someFilename'
<readerClass> save: anImage onStream: aStream

Capturing Images[Bearbeiten]

Images can be captured from the screen with:

Image fromScreen
Image fromScreen: aRectangle

Manipulating Images[Bearbeiten]

A few often used image manipulation functions are already built in. More siphisticated functions can be called via Python or C actions, which call into an imported image maniulation library.

Things you can do out-of-the-box are:

anImage magnifiedBy:scaleFactor
anImage magnifiedTo:anExtent smooth:aBoolean
anImage magnifiedPreservingRatioTo:anExtent smooth:aBoolean
anImage rotatedBy: angleInDegrees 
anImage subImageIn: aRetangle
anImage flipVertical / flipHorizontal

Examples[Bearbeiten]

Take a Screenshot, extracting a Rectangle, scaling it and saving on File[Bearbeiten]

|img subImg magImg|
img := Image fromScreen.
subImg := img subImageIn:( 0@0 extent:400@400).
magImg := subImg magnifiedTo:200@200 smooth:true.
PNGReader save:magImg onFile:'testFile.png'.
"/ the following opens a viewer on the file
OperatingSystem openApplicationForDocument:'testFile.png' operation:#open.

Limitations[Bearbeiten]

Although expecco supports a wide range of bitmap image formats, some rarely used formats are not supported, or only supported with limitations.

GIF[Bearbeiten]

Reading and writing of 8 bit/pixel palette images is supported. Other images should be converted to 8bpp before writing. Tiled images with multiple palettes are not supported.

JPEG[Bearbeiten]

Reading and writing of 24bit/pixel is supported. Expecco uses the libjpeg library, so any format supported by that (standard) library will also be supported by expecco.

PNG[Bearbeiten]

(see http://www.schaik.com/pngsuite/pngsuite.html)

  • Grayscale + alpha: reading unsupported (as of 2.11)
  • 16bit RGB + alpha: incorrect display
  • tRNS chunk with alpha values (only on-off masks)

When writing, expecco will always generate either 8bpp palette, or 24bpp truecolor images.

BMP[Bearbeiten]

1, 4, 8, 24 and 32 bpp files can be read and written.

TIFF[Bearbeiten]

Most formats are supported in reading, with some limitations:

  • supported compressions:
    • CCITT group3 FAX compression
    • LZW
    • packbits

1, 4, 8 and 24 bit files can be written. Data is always written uncompressed. No support for image masks or alpha channels.

XBM[Bearbeiten]

Both, reading and writing

XPM[Bearbeiten]

Some restrictions apply (to be documented)



Copyright © 2014-2024 eXept Software AG