Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
GMImage.SetType
Sets the Image representation type.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| GraphicsMagick | 2.0 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| type | UndefinedType = 0, BilevelType = 1, GrayscaleType = 2, GrayscaleMatteType = 3, PaletteType = 4, PaletteMatteType = 5, TrueColorType = 6, TrueColorMatteType = 7, ColorSeparationType = 8, ColorSeparationMatteType = 9, OptimizeType = 10 | 6 |
Result
Returns "OK" on success.
Description
Sets the Image representation type.Changing the type from TrueColorType to GrayscaleType will convert a color picture to grayscale.
Examples
Change the picture to grayscale.
Let ( [
$Image = MBS("GMImage.NewFromContainer"; GraphicsMagick::image);
$Result = MBS("GMImage.SetType";$Image; 2);
$Result = MBS("GMImage.WriteToPNGContainer"; $Image);
$Error = MBS("GMImage.Release";$Image)
];
$Result)
Convert image to 1 bit TIFF:
# Load from container
$Image = MBS("GMImage.NewFromContainer"; GraphicsMagick::image);
# make black and white with threshold
$Result = MBS("GMImage.Threshold";$Image; 127);
# mark as monochrome image
$Result = MBS("GMImage.SetMonochrome";$Image; 1);
# set type to 1 for black/white
$Result = MBS("GMImage.SetType";$Image; 1);
# set to use TIFF for compression
$Result = MBS("GMImage.SetMagick";$Image; "TIFF");
# set to use CCITT 4 Fax compression
$Result = MBS("GMImage.SetCompressType";$Image; 4);
# and write to a file
$Result = MBS("GMImage.WriteToFile"; $Image; "/tmp/test.tif");
# cleanup
$Error = MBS("GMImage.Release";$Image)
Change picture to RGB:
MBS("GMImage.SetType"; $image; 6);
Replace white with transparent:
Set Variable [$BigImageRef; Value:MBS("GMImage.NewFromContainer"; Test::BigImage)]
# Set type to RGBA
Set Variable [$Result; Value:MBS("GMImage.SetType"; $BigImageRef; 7)]
# Replace white with transparent
Set Variable [$Result; Value:MBS("GMImage.ReplaceColor"; $BigImageRef; "white"; "transparent"; 10)]
# save as PNG
Set Field [Test::Result; MBS( "GMImage.WriteToPNGContainer"; $BigImageRef )]
Set Variable [$Error; Value:MBS("GMImage.Release";$BigImageRef)]
See also
- GMImage.GetType
- GMImage.SetFont
- GMImage.SetLabel
- GMImage.SetMatte
- GMImage.SetMonochrome
- GMImage.SetQuiet
- GMImage.SetScene
- GMImage.SetView
- GMImage.Threshold
- GMImage.WriteToFile
Example Databases
- Barcode/Swiss QR-Code for invoices ISO 20022
- DynaPDF/Scan with WIA to PDF
- GraphicsMagick/Create GIF
- GraphicsMagick/GraphicsMagick Sample
- GraphicsMagick/Reduce Image
- GraphicsMagick/SVG to PNG
Blog Entries
- Convert a SVG image to PNG with alpha channel
- Create PDF from scanned images and skip blank pages
- QR Codes for Invoices in Switzerland
FileMaker Magazin
Created 18th August 2014, last changed 21st December 2018
GMImage.SetTileName - GMImage.SetVerbose
Feedback: Report problem or ask question.
Links
MBS Xojo Chart Plugins