C++ – Background Gradient with Magick++


How do I create gradients with ImageMagick in C++?

I am trying to create a visual representation of a WAV file.

I can create an Image with Magick++, draw in the waveform data and save the image as a .png file but it still looks a bit basic.

I'd like to give the image background and waveform gradients but I don't know how.

Are there any examples of how to create gradients using Magick++?

Many thanks,

Best Solution

I believe you would have to use the Pixel class and interpolate Colors to create your own gradient fill.

The manual for Magick++ does not indicate that it has native functions for gradient fill.

It may also be possible to use the core ImageMagick API for gradient fill.

Here's some useful links:

Edit - The Magick Core API does have a DrawGradientImage function which may help you out.

Here's some more useful links:

Related Question