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.Quantize
Quantize image (reduce number of colors).
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| GraphicsMagick | 2.0 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| ImageRef | The image reference number. | 1 | |
| measureError | Optionally, a boolean value. | 0 | Optional |
Result
Returns "OK" on success.
Description
Quantize image (reduce number of colors).See GMImage.SetQuantizeColorSpace, GMImage.SetQuantizeColors, GMImage.SetQuantizeDither and GMImage.SetQuantizeTreeDepth for options.
Examples
Quantize picture:
Set Variable [ $BigImageRef ; Value: MBS("GMImage.NewFromContainer"; Test::BigImage) ]
# reduce to 20 colors, so we see the effect. Normally 256
Set Variable [ $Result ; Value: MBS( "GMImage.SetQuantizeColors"; $BigImageRef; 20) // 256 ) ]
# Enable dithering, turn off to really see the effect
Set Variable [ $Result ; Value: MBS( "GMImage.SetQuantizeDither"; $BigImageRef; 1 ) ]
# Quantize to palette colors
Set Variable [ $Result ; Value: MBS( "GMImage.SetQuantizeColorSpace"; $BigImageRef; 4 /* palette */ ) ]
# Do it!
Set Variable [ $Result ; Value: MBS("GMImage.Quantize"; $BigImageRef) ]
# Type should now be 4 for palette
Set Variable [ $Result ; Value: MBS("GMImage.GetType"; $BigImageRef) ]
# save as GIF
Set Field [ Test::Result ; MBS( "GMImage.WriteToGIFContainer"; $BigImageRef ) ]
Set Variable [ $Error ; Value: MBS("GMImage.Release";$BigImageRef) ]
See also
- GMImage.Equalize
- GMImage.GetType
- GMImage.New
- GMImage.NewFromContainer
- GMImage.Release
- GMImage.SetQuantizeColors
- GMImage.SetQuantizeColorSpace
- GMImage.SetQuantizeDither
- GMImage.SetQuantizeTreeDepth
- GMImage.WriteToGIFContainer
Created 18th August 2014, last changed 21st December 2018
GMImage.PushClipPath - GMImage.QuantumDepth
Feedback: Report problem or ask question.
Links
MBS Xojo Chart Plugins