« MBS Xojo Plugins, ver… | Home | MBS @ FMTraining.TV -… »

GraphicsMagick in FileMaker, part 2

🎄
2 of 24

Welcome to the second door of our advent calendar in this advent calendar. I would like to take you on a journey through the GraphicsMagick component in December. Every day I will introduce you to one or more functions from this component. In this component you will find functions with which you can analyze images, convert them, change them with filters, you can draw them and much much more. In the end, you can also take the magic of GraphicsMagick to your images. I wish you a lot of fun with it.

Today I want to find out with you some information about the loaded images. We will start with the size of the images. So we want to find out height and width. First we load our image into memory as we saw it yesterday. In our example there is a single image in the container.

Set Variable [ $GM ; Value: MBS("GMImage.NewFromContainer"; GraphicsMagick Advent::Image) ] 

Now we can retrieve different information. The width with the function GMImage.GetWidth and the height with GMImage.GetHeight function. The reference is passed to the functions in the parameters and we then get back the desired value.

Set Variable [ $Width ; Value: MBS( "GMImage.GetWidth"; $GM ) ] 
Set Variable [ $Height ; Value: MBS( "GMImage.GetHeight"; $GM ) ] 

We can also get the height and width directly in one step. For this we use the function GMImage.GetSize. Here we get width and height separated with an X as result.

Set Variable [ $Size ; Value: MBS( "GMImage.GetSize"; $GM ) ] 

Besides the size, we can also query other information about the image, e.g. what file format does the image have? We can easily answer this question with the function GMImage.GetMagick, because it gives us the codec used.

Set Variable [ $FileTyp ; Value: MBS( "GMImage.GetMagick";$GM ) ] 

With the function GMImage.GetDensity we query the resolution. We get the resolution of the width and the height again separated by an x.

Set Variable [ $Resolution ; Value: MBS( "GMImage.GetDensity";$GM ) ]

The file name can be queried with GMImage.GetFileName.

Set Variable [ $FileName ; Value: MBS( "GMImage.GetFileName"; $GM ) ] 

Also the file size can be determined with the function GMImage.GetFileSize.

Set Variable [ $FileSize ; Value: MBS( "GMImage.GetFileSize"; $GM ) ] 

Here you can see how a dialog can look like if we print the information in the dialog.

GraphicsMagick has many more functions that you can use to get information about your images. Please have a look. I wish you a nice 2nd December and I am looking forward to seeing you tomorrow.

Previous day   Next day

02 12 22 - 07:25