Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.0   8.1   8.2   8.3   8.4   8.5   9.0   9.1   9.2   9.3    Statistic  


Crop image (subregion of original image).

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
GraphicsMagick 2.0 Yes Yes Yes Yes Yes
MBS( "GMImage.Crop"; ImageRef; geometry )   More


Parameter Description Example value
ImageRef The image reference number. 1
geometry The rectangle to crop.
Geometry is specified as a width and height "100x200". With an optional offset "100x200+10+20". For percent values, add a percent on the end, for % values add a %: "100x200%!"


Returns "OK" on success.


Crop image (subregion of original image).
You can add pixels with GMImage.Border function.


Crops the image:

Let ( [
$Image = MBS("GMImage.NewFromContainer"; GraphicsMagick::image);
$Width = MBS("GMImage.GetWidth";$Image);
$Height = MBS("GMImage.GetHeight";$Image);
$Width = $Width/2;
$Height = $Height/2;
$ScaleResult = MBS("GMImage.Crop";$Image; $Width & "x" & $Height);
$Result = MBS("GMImage.WriteToPNGContainer"; $Image);
$Error = MBS("GMImage.Release";$Image)

See also

Example Databases

Created 18th August 2014, last changed 13th May 2019

GMImage.CopyChannel   -   GMImage.CycleColormap

Feedback: Report problem or ask question.

MBS Xojo tutorial videos