How to blend + translate simultaneously 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
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

Hi ImageMagick Community!

Any idea how I can shift two images and blend them at the same time ?

I've illustrated this question here with images.

Cheers,

Jozsef
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to blend + translate simultaneously with Imagemagick?

Post by snibgo »

The apples also need enlarging. There are many ways to do this. One is (Windows BAT syntax):

Code: Select all

convert ^
  8BwgI.jpg ^
  ( VR76n.jpg ^
    -resize 150%% ^
    -alpha Opaque ^
    -channel A -evaluate Multiply 0.5 +channel ^
    -set page +1200+30 ^
  ) ^
  -background White ^
  -layers merge ^
  a.png
snibgo's IM pages: im.snibgo.com
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

Many thanks Snibgo, I try it.
Last edited by jhegedus42 on 2015-09-05T08:09:47-07:00, edited 1 time in total.
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

I have a related question, is there a way to do this blending trick in ImageMagick ?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to blend + translate simultaneously with Imagemagick?

Post by Bonzo »

Yes; check out this link and a bit further up the page: http://www.imagemagick.org/Usage/photos/#double
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

I tried this command :

Code: Select all

convert input02.jpg  (input01.jpg -resize 150%% -alpha Opaque -channel A -evaluate Multiply 0.5 +channel -set page +1200+30)  -background White -layers merge a.jpg
and it gave me an error like :

Code: Select all

./convert.sh: line 10: syntax error near unexpected token `('
./convert.sh: line 10: `convert input02.jpg  (input01.jpg -resize 150%% -alpha Opaque -channel A -evaluate Multiply 0.5 +channel -set page +1200+30)  -background White -layers merge a.jpg'
I wonder what is the corresponding syntax in Linux?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to blend + translate simultaneously with Imagemagick?

Post by snibgo »

I had a space on each side of my parenthesis ( and ) . Why did you remove the spaces?

In Windows BAT, each % is (often) doubled. Not in bash.
snibgo's IM pages: im.snibgo.com
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

Hi Snibgo,

I tried also this:

Code: Select all

convert input02.jpg  ( input01.jpg -resize 150% -alpha Opaque -channel A -evaluate Multiply 0.5 +channel -set page +1200+30 )  -background White -layers merge a.jpg
Same error.
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

Code: Select all

convert input02.jpg  \( input01.jpg -resize 150% -alpha Opaque -channel A -evaluate Multiply 0.5 +channel -set page +1200+30 \)  -background White -layers merge a.jpg
run without error....
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

Magically it gives the wished result. Cool ! Thanks!
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to blend + translate simultaneously with Imagemagick?

Post by Bonzo »

As you have not told us how you are running the code we have to guess. Linux needs \( \) but windows only needs ( )
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to blend + translate simultaneously with Imagemagick?

Post by fmw42 »

Always provide your version of IM and platform. It saves time and frustration due to syntax issues.

See the very top link on the User's forum, which is viewtopic.php?f=1&t=9620
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

Bonzo wrote:Yes; check out this link and a bit further up the page: http://www.imagemagick.org/Usage/photos/#double
Many thanks for the tip, that page is also very useful.
jhegedus42
Posts: 10
Joined: 2015-09-05T07:29:25-07:00
Authentication code: 1151

Re: How to blend + translate simultaneously with Imagemagick?

Post by jhegedus42 »

fmw42 wrote:Always provide your version of IM and platform. It save time and frustration due to syntax issues.

See the very top link on the User's forum, which is viewtopic.php?f=1&t=9620
Ok, I read it more carefully once more.
Post Reply