Using modulate on part of an image

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
jaconat

Using modulate on part of an image

Post by jaconat »

Hi,

New to ImageMagick so bear with me. I am using the convert command (see below) to overlay a picture on a background image, resize it, add some text and a white border around the picture. However I want to lighten the picture that I am overlaying. I have played about with the -modulate switch but it only ever lightens the entire image. Is it possible to do it in a single command or will I need to do it in 2 steps (not ideal as I don't really want to duplicate or modify the original image)?

So, my line is

Code: Select all

convert 'background.png' \
picture.jpg'[600x450]' -geometry +116+76 -modulate 120 -composite \
-fill none -stroke white -strokewidth 10 \
-draw "roundrectangle 116,76 716,526 12,12" \
-fill white -stroke none -strokewidth 0 -weight normal -style normal \
-font freakturbulance -gravity northwest -pointsize 20 \
-draw "text 90,580 'Name'" \
-font freakturbulance -gravity northeast -pointsize 35 \
-draw "text 90,570 'Joseph'" \
'newimage.png'
Ideally I want the line....

Code: Select all

picture.jpg'[600x450]' -geometry +116+76 -modulate 120 -composite
processed independently before being overlayed onto the background image.

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

Re: Using modulate on part of an image

Post by snibgo »

Have you tried:

\( picture.jpg'[600x450]' -geometry +116+76 -modulate 120 \) -composite

?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Using modulate on part of an image

Post by fmw42 »

snibgo wrote:Have you tried:

\( picture.jpg'[600x450]' -geometry +116+76 -modulate 120 \) -composite

?
[600x450] is not a valid subsection as far as I know. You must specify the offsets as well

[WidthxHeight+Xoffset+Yoffset]

e.g.

[600x450+0+0]

for the top left subsection
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Using modulate on part of an image

Post by magick »

Try the -region option. It applies an option to only a region of your image (instead of the whole image).
jaconat

Re: Using modulate on part of an image

Post by jaconat »

Tried using the brackets as suggested by snibgo but got the error

Code: Select all

./myscript.sh: line 6: syntax error near unexpected token `('
./myscript.sh: line 6: (`picture.jpg'[570x760]' -geometry +90+73 -modulate 160) -composite \'
Tried brackets in a simpler script but got the same syntax error. Is this right? I'm using Ubuntu 9.04. Don't expect so but do I need to enable brackets :? ? Any suggestions?

Thanks for the -region switch Magick. I'll give that a try next.
jaconat

Re: Using modulate on part of an image

Post by jaconat »

Thanks Magick, the -region switch worked. Added the line

Code: Select all

-region 600x450+116+76 -modulate 120,120 -region 100%
between lines 2 & 3 on the original code. :D
Post Reply