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.GetPixelColor
Get pixel color at location x & y.
| 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 |
| x | The horizontal position. Range from 0 to GMImage.GetWidth-1. | 0 |
| y | The vertical position. Range from 0 to GMImage.GetHeight-1. | 0 |
Result
Returns a color value as string.
Description
Get pixel color at location x & y.Returned color is 16bit in v9.0 or later.
You may need to divide values by 257 if you need 8 bit values.
Examples
Open picture and read first pixel:
Let ( [
$Image = MBS("GMImage.NewFromContainer"; GraphicsMagick::image);
$colorValue = MBS("GMImage.GetPixelColor"; $Image; 0; 0);
$Error = MBS("GMImage.Release";$Image)
];
$colorValue )
Trims space around image and make transparent:
Set Variable [$BigImageRef; Value:MBS("GMImage.NewFromContainer"; Test::BigImage)]
Set Variable [$Result; Value:MBS( "GMImage.SetBackgroundColor"; $BigImageRef; "RGB 1 0 0" )]
Set Variable [$Result; Value:MBS("GMImage.Trim"; $BigImageRef)]
Set Variable [$Result; Value:MBS( "GMImage.SetColorFuzz"; $BigImageRef; 5 )]
Set Variable [$Result; Value:MBS( "GMImage.SetMatte"; $BigImageRef; 1 )]
Set Variable [$farbe; Value:MBS( "GMImage.GetPixelColor"; $BigImageRef; 0; 0 )]
Set Variable [$Result; Value:MBS( "GMImage.ReplaceColor"; $BigImageRef; $farbe; "RGB 1 1 1 1"; 5)]
Set Field [Test::Result; MBS( "GMImage.WriteToPNGContainer"; $BigImageRef )]
Set Variable [$Error; Value:MBS("GMImage.Release";$BigImageRef)]
See also
- GMImage.GetBorderColor
- GMImage.GetHeight
- GMImage.GetMatteColor
- GMImage.GetStrokeColor
- GMImage.GetWidth
- GMImage.SetBorderColor
- GMImage.SetBoxColor
- GMImage.SetColorFuzz
- GMImage.SetFillColor
- GMImage.SetMatteColor
Example Databases
Blog Entries
Created 18th August 2014, last changed 9th January 2020
GMImage.GetPage - GMImage.GetProfile
Feedback: Report problem or ask question.
Links
MBS FileMaker tutorial videos