how merge some image on path with imagemagick?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

how merge some image on path with imagemagick?

Post by mostafanastary »

Hi, in this topic : viewtopic.php?f=1&t=26612
i create circle image with some image, but if we want to create another path like :

Image

or

Image

or any path we want, is there any solution?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how merge some image on path with imagemagick?

Post by fmw42 »

The easiest solution is to pick the points on the path where you want each image to be located. See
http://www.imagemagick.org/Usage/layers/#convert
or
http://www.imagemagick.org/Usage/layers/#flatten
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: how merge some image on path with imagemagick?

Post by mostafanastary »

thank you fred,
it can be work for me,
best regards
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how merge some image on path with imagemagick?

Post by fmw42 »

Free hand paths would need to use a spline on a few selected (knot) points. That would be much more complicated but could be done by using my script, spline (see my signature link below).

However, you can use the same technique as the circle with any other mathematical equation for some curve using the math functions in -fx. For example, it would be easy to make a sinusoidal (wave) pattern using just sin() or cos(). See http://www.imagemagick.org/script/fx.php
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: how merge some image on path with imagemagick?

Post by mostafanastary »

very very good script, i will try that, thank you fred.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how merge some image on path with imagemagick?

Post by fmw42 »

The spline script by itself is not sufficient. It would have to be the basis of another script to take the spline data and pick equal interval points to use for each input image you provide. The spline script does not output the spline data. It just draws it in an image.

Also see Bezier splines in IM at http://www.imagemagick.org/Usage/draw/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how merge some image on path with imagemagick?

Post by fmw42 »

User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how merge some image on path with imagemagick?

Post by fmw42 »

This may not be exactly what you want, but you can use montage to combine images (I just duplicated one, but you can provide a list to montage and script the first convert and pipe). Then use a warp such -wave to do the following:

input:
Image

Code: Select all

convert question.gif -duplicate 19 miff:- |\
montage - -tile 20x -geometry +10+0 miff:- |\
convert - -wave 30x300 question_wave.gif

Image


You can avoid the distortion by just using the original circle method with a sin or cos function for -fx to achieve something similar.
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: how merge some image on path with imagemagick?

Post by mostafanastary »

Wow, prefect.
thank you for share.
Post Reply