Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   7.6    Statistic  

GMImage.SetResolutionUnits

Sets which units are used for image resolution.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
GraphicsMagick 2.0 Yes Yes Yes Yes Yes

MBS( "GMImage.SetResolutionUnits"; ImageRef; ResolutionType )

Parameters

Parameter Description Example value
ImageRef The image reference number. 1
ResolutionType UndefinedResolution = 0, PixelsPerInchResolution = 1, PixelsPerCentimeterResolution = 2 1

Result

Returns "OK" on success.

Description

Sets which units are used for image resolution.

Examples

Convert and Scale:

# Load image from container
Variable setzen [ $image ; Wert: MBS( "GMImage.NewFromContainer"; SVG to PNG::InputFile ) ]
Variable setzen [ $name ; Wert: MBS( "Files.FileName"; LiesAlsText(SVG to PNG::InputFile) ) ]
# Scale if parameters are filled in fields
Wenn [ IstLeer ( SVG to PNG::Target Width in Pixel ) ]
    Wenn [ IstLeer ( SVG to PNG::Target Height in Pixel ) ]
        # both empty, do nothing
    Sonst
        Variable setzen [ $r ; Wert: MBS( "GMImage.Scale"; $image; "99999x" & SVG to PNG::Target Height in Pixel & ">") ]
    Ende (wenn)
Sonst
    Wenn [ IstLeer ( SVG to PNG::Target Height in Pixel ) ]
        Variable setzen [ $r ; Wert: MBS( "GMImage.Scale"; $image; SVG to PNG::Target Width in Pixel& ">" ) ]
    Sonst
        Variable setzen [ $r ; Wert: MBS( "GMImage.Scale"; // function $image; // pass in picture SVG to PNG::Target Width in Pixel & // width "x" & // by SVG to PNG::Target Height in Pixel & // height ">" // scale only if it will get smaller ) ]
    Ende (wenn)
Ende (wenn)
# If a resolution is defined, put it in
Wenn [ NICHT IstLeer ( SVG to PNG::Resolution in DPI ) ]
    Variable setzen [ $r ; Wert: MBS( "GMImage.SetResolutionUnits"; $image; 1 /* pixel per inch */ ) ]
    Variable setzen [ $r ; Wert: MBS( "GMImage.SetDensity"; $image; SVG to PNG::Resolution in DPI & "x" & SVG to PNG::Resolution in DPI) ]
Ende (wenn)
# Output to container
Feldwert setzen [ SVG to PNG::OutputFile ; MBS( "GMImage.WriteToPNGContainer"; $image; $name & ".png") ]
# Cleanup
Variable setzen [ $r ; Wert: MBS("GMImage.Destroy"; $image) ]

See also

Example Databases


GMImage.SetRenderingIntent   -   GMImage.SetScene

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins