« Using MBS to Extend X… | Home | GraphicsMagick in Fil… »

GraphicsMagick in FileMaker, part 11

🎄
11 of 24

Welcome to the 11th 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, draw them and much much more. In the end, you too can take the magic of GraphicsMagick to your images. I wish you a lot of fun in the process.

The GraphicsMagick also provides many effects that we can apply to our images. In the Advent calendar we would like to introduce a few of these effects. Today I will show you how to add a noise effect to your image. So we want to bring in a noise effect. For this we have two functions that we can use. We have the simpler function GMImage.AddNoise which adds a noise to the image which we can define in the parameters. We have a total of 6 noise types that we can specify.

  • UniformNoise = 0
  • GaussianNoise = 1
  • MultiplicativeGaussianNoise = 2
  • ImpulseNoise = 3
  • LaplacianNoise = 4
  • PoissonNoise = 5

In the parameters we specify the appropriate number. In this script line, for example, the noise type ImpulseNoise was selected.

Set Variable [ $r ; Value: MBS( "GMImage.AddNoise"; $GM; 3) ] 

On the following images a couple of the mentioned noise methods were applied 3 times in a row.

First of all here is the original image

The Gaussian noise mode was applied to this image

This image has the Laplacian noise mode applied

And for this image we use the impulse noise

But we can specify the noise even further. Noise is pixels that normally do not belong to the image.

Here we intentionally apply them to an image as an effect. In photography they are image noise caused for example by photo sensors. You can further define the noise with the function GMImage.AddNoiseChannel, for example you can show only the noise pixels from the Red Channel. Thus we see here on the black only red blinkers.

In the GMImage.AddNoiseChannel function, the noise selection is still the same, but we also specify a channel in the function. You can choose from these channels:

  • RedChannel = 1
  • CyanChannel = 2
  • GreenChannel = 3
  • MagentaChannel = 4
  • BlueChannel = 5
  • YellowChannel = 6
  • OpacityChannel = 7
  • BlackChannel = 8
  • MatteChannel = 9
  • AllChannels = 10
  • GrayChannel = 11

The code then looks like this for RedChannel and ImpulseNoise noise:

 Set Variable [ $r ; Value: MBS( "GMImage.AddNoiseChannel"; $GM; 1; 3 ) ] 

I hope you enjoyed this and we will meet again tomorrow

Previous day   Next day

11 12 22 - 09:35