Floating point pixel coordinates

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
pulsar
Posts: 6
Joined: 2015-03-18T11:21:35-07:00
Authentication code: 6789

Floating point pixel coordinates

Post by pulsar »

I had very little experience with ImageMagick C API in the past, mostly by means of finding a similar example code and adopting it to my needs, but now I am trying to accomplish a project in which I don't even know if it is doable with ImageMagick, and don't know where to start.

In short, I want to do my own (fairly complex) warping/distortion of images. I have all the math. What I need is a way to read color information (r,g,b,alpha) for floating point pixel coordinates in the input image. The color should be computed by ImageMagick using an interpolation from the neighboring pixels.

I do see the interpolation discussed here: http://www.imagemagick.org/Usage/misc/#interpolate , where the functionality I need (floating point pixel coordinates) is described. But this is not for C API, just for command line.

Is floating point pixels coordinates (get color via interpolation) feature supported by C API? In MagickWand, I could only find get color methods which use integer pixel coordinates (PixelWand). I couldn't find anything relevant in MagickCore description.

Thank you very much for any feedback!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Floating point pixel coordinates

Post by snibgo »

pulsar wrote:Is floating point pixels coordinates (get color via interpolation) feature supported by C API?
Yes. I use InterpolateMagickPixelPacket(...), defined in pixel.h. This respects the -virtual-pixel and -interpolate settings. See examples in http://im.snibgo.com/customim.htm
snibgo's IM pages: im.snibgo.com
pulsar
Posts: 6
Joined: 2015-03-18T11:21:35-07:00
Authentication code: 6789

Re: Floating point pixel coordinates

Post by pulsar »

snibgo wrote:
pulsar wrote:Is floating point pixels coordinates (get color via interpolation) feature supported by C API?
Yes. I use InterpolateMagickPixelPacket(...), defined in pixel.h. This respects the -virtual-pixel and -interpolate settings. See examples in http://im.snibgo.com/customim.htm
That's perfect - your link even contains an example code! Thank you very much!
Post Reply