views:

180

answers:

1

Hi, 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, Josh

A: 

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:

Ok, I was hoping someone would show me a fillGradient() function but I guess it wouldn't be too hard to loop though a matrix and set the colour of each pixel. I probably need to continue reading the manual.Thanks anyway.
Josh