Supported Image File Formats/en: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
 
(6 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
Although expecco supports a wide range of bitmap image formats,
The underlying runtime framework supports the most common bitmap/image formats:
GIF, JPEG, PNG, TIFF, BMP, XPM and a few other less common formats.
some seldom used formats are not supported, or only supported with limitations.


== GIF ==
=== Other Formats ===
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 ==
reading and writing of 8 bit/pixel palette images is supported.
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''" &#8594; "''Tools''" &#8594; "''Class Browser''")

== Image Writing ==
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 ==
Images can be captured from the screen with:
Image fromScreen
Image fromScreen: aRectangle

== Manipulating Images ==
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 ===

==== Take a Screenshot, extracting a Rectangle, scaling it and saving on File ====

|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 ==

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

=== GIF ===

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


== JPEG ==
=== JPEG ===


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


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


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


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


== BMP ==
=== BMP ===


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


== TIFF ==
=== TIFF ===
most formats are supported in reading, with some limitations:
Most formats are supported in reading, with some limitations:
* supported compressions:
* supported compressions:
** CCITT group3 FAX compression
** CCITT group3 FAX compression
** LZW
** LZW
** packbits
** packbits
1, 4, 8 and 24 bit files can be written


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


== XPM ==
=== XBM ===
Both, reading and writing
some restrictions apply (to be documented)


== Other Formats ==
=== XPM ===
Some restrictions apply (to be documented)
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.

Aktuelle Version vom 18. Juli 2023, 13:27 Uhr

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