Topics   All   Mac OS X (Only)   Windows (Only)   Crossplatform   Server   Client   Components   Guides   Statistic  
New in version: 3.0   3.1   3.2   3.3   3.4   3.5   4.0   4.1   4.2   4.3   4.4   5.0   5.1   5.2   5.3   5.4  


Component: GraphicsMagick
Version: 2.0
Mac OS X: Yes
Windows: Yes
Server: Yes

MBS( "GMImage.WriteToPNGContainer"; ImageRef; {Filename} )


Parameter Description Example value
ImageRef The image reference (a number returned from the GMImage.New functions) 1
Filename Optional
The file name to use for the container. Default is "image.png"


Returns a container value.


Writes the picture in PNG format to a container object which you can store in a container field.
For preview a JPEG version is included as well as a file name "image.png" and the image size.
See also GMImage.WriteToFile, GMImage.WriteToJPEGContainer, GMImage.WriteToBMPContainer and GMImage.WriteToGIFContainer.

Some images have bad ICC profile, so saving them will crash (version 3.4 or lower) or return error (3.5 and newer). In this case, please use MBS("GMImage.SetICCColorPRofile"; ImageRef; "") to remove the profile.


Get a container value from the picture in PNG format.

MBS( "GMImage.WriteToPNGContainer"; $MyImageRef; "logo.png" )

Make a barcode and store it as PNG in a container:

Set Variable [$image; Value:MBS( "Barcode.Generate"; "UPCA"; "72527270270")]
If [MBS("Iserror") = 0]
    Set Field [MyTable::BarCodeContainer; MBS( "GMImage.WriteToPNGContainer"; $image; "barcode.png" )]
    Set Variable [$r; Value:MBS("GMImage.Destroy"; $image)]
    Set Field [MyTable::BarCodeContainer; ""]
End If

Create red square and save to container:

Set Variable [$img; Value:MBS( "GMImage.New"; "16x16"; "red" )]
Set Field [test::test; MBS( "GMImage.WriteToPNGContainer"; $img; "test.png" )]
Set Variable [$r; Value:MBS( "GMImage.Destroy"; $img)]

See also

GMImage.WriteToJPEGContainer   -   GMImage.WriteToTiffContainer

Feedback: Report problem or ask question.

MBS Filemaker Plugins - Pfarrgemeinde Ministranten Nickenich