Page 1 of 1

Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T21:39:04-07:00
by agriz
exec("/usr/bin/convert -size 496x709 pattern:HORIZONTALSAW img.png");
exec("/usr/bin/composite img.png source.jpg -displace 50 output.png");

I would like to get the displace image. I don't want the source image.
The displace effect is looking good. How do i get that image alone?

Image

Re: Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T22:05:18-07:00
by fmw42
I do not think that a binary image pattern such as the saw patterns make for good displacement images as you are doing here. Your img.png is the displacement image.

see
http://www.imagemagick.org/Usage/mappin ... e_displace

Use a different displacement image -- smoother pattern and don't use such a large -displace value. You can see the displaced image in the original because the only parts that are displace are the zigzag and that is shifted 50 right and 50 down. Look at the red lines coming from her red top.

The fact that you zigzag is binary is why the two images seem overlapped. Some parts are displaced and others not.

Re: Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T22:23:25-07:00
by agriz
composite {displacement_map} {input_image} -displace {X}x{Y} {result}
According to this example,
img.png is the displacement_map
source.png is the input_image
and output.png is the result

Is that black border, i drawn, the displaced image of original image?

Re: Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T22:28:57-07:00
by anthony
For just the displaced image, use the displacement image simply as a mask instead.

Unless I am not understanding 'I would like to get the displace image.'


Warning -displace 50, displaces 50 pixels in BOTH the X and Y directions.
See Image Mapping Effects
http://www.imagemagick.org/Usage/mappin ... ement_maps

Re: Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T22:30:15-07:00
by fmw42
It is a portion of the displaced part. But there are other displaced parts that you have missed.

I suspect that what you really want is just to:

composite img.png source.png -compose multiply result.png

or -negate your img.png

one or the other may give you want you want.

If you want to shift that result, then use +distort SRT


Note composite is really getting very outdated and will likely go away in IM 7. So I suggest you start using convert ... -compose xxx -composite ...

The convert approach is much more flexible, has more options and is the more modern IM 6 syntax.

see
http://www.imagemagick.org/script/compose.php
http://www.imagemagick.org/Usage/layers/#convert

Re: Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T22:34:30-07:00
by anthony
For interger pixel shifts you can also use something like.

Code: Select all

-repage +{X}+{Y} -background {COLOR} -flatten

Re: Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T22:40:28-07:00
by agriz
-negate gave me good effect.
I am working on different value on -repage with different bg color.

There is lot and lot to learn in imagemagick :)

Re: Displace - Split Source and Displaced Image Possible?

Posted: 2012-03-04T22:44:31-07:00
by fmw42
agriz wrote: There is lot and lot to learn in imagemagick :)

Quite true! Keep up the study and practice.