Reszie overlay and output

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
Thunder07
Posts: 3
Joined: 2012-09-25T09:57:24-07:00
Authentication code: 67789

Reszie overlay and output

Post by Thunder07 »

hi,
im trying to combine 2 images, resizing the 1st and the output...
i got close enough but not quite right

Code: Select all

composite ( -gravity center -geometry +0+0 -resize 80x80 charge.png ) ( full.png ) out.png
Image
this will resize the overlay charge.png but not the output...

when i try this

Code: Select all

composite ( -gravity center -geometry +0+0 -resize 80x80 charge.png ) ( full.png ) -resize 48x48 out.png
Image
it reszie but the ratio of the overlay get messed up....
the overlay appears much bigger then it should,
i know i could have a 2nd line to do the resizing of the output which would solve the problem,
but i much prefer to have it in the one command if possible
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Reszie overlay and output

Post by fmw42 »

Post links to your two input images and show an example of what you want for the output. We can probably help you with the command line once we understand what the issue is.

In the meantime see the geometry modifiers at http://www.imagemagick.org/script/comma ... p#geometry
Thunder07
Posts: 3
Joined: 2012-09-25T09:57:24-07:00
Authentication code: 67789

Re: Reszie overlay and output

Post by Thunder07 »

fmw42 wrote:Post links to your two input images and show an example of what you want for the output. We can probably help you with the command line once we understand what the issue is.

In the meantime see the geometry modifiers at http://www.imagemagick.org/script/comma ... p#geometry
these are the 2 output images,
ImageImage
i'm trying to resize the charge/bolt place it on the battery and resize the whole thing

and this is how it should/ i want it to look
Image
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Reszie overlay and output

Post by Bonzo »

Try:

Code: Select all

convert http://i46.tinypic.com/2874h2.png ( http://i47.tinypic.com/5nvgh4.png -resize x75 )  -gravity center -composite -resize x23 battery.png
I would look at changing the "lightning bolt" colour or the battery colour as you can hardly see the "lightning bolt".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Reszie overlay and output

Post by fmw42 »

The problem is that composite it too old and inflexible and the -resize before the output is causing trouble. Try using the more modern and more flexible convert ... -composite syntax.

convert ( full.png ) ( charge.png -resize 80x80 ) -gravity center -compose over -composite -resize 48x48 out.png

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



OOPS: Sorry Bonzo, you posted something similar while I was composing my reply.
Thunder07
Posts: 3
Joined: 2012-09-25T09:57:24-07:00
Authentication code: 67789

Re: Reszie overlay and output

Post by Thunder07 »

Bonzo wrote:Try:

Code: Select all

convert http://i46.tinypic.com/2874h2.png ( http://i47.tinypic.com/5nvgh4.png -resize x75 )  -gravity center -composite -resize x23 battery.png
I would look at changing the "lightning bolt" colour or the battery colour as you can hardly see the "lightning bolt".
thanks,
i'm not really worried too much about visibility as the size (or colour as you suggested and the battery picture would also be different) can fix that,
i'm building a tool with a resizing option and the bolt is changable by the user :)
fmw42 wrote:The problem is that composite it too old and inflexible and the -resize before the output is causing trouble. Try using the more modern and more flexible convert ... -composite syntax.

convert ( full.png ) ( charge.png -resize 80x80 ) -gravity center -compose over -composite -resize 48x48 out.png

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

OOPS: Sorry Bonzo, you posted something similar while I was composing my reply.
Thanks just the same.



i've been trying to get this to work for a while now,
and this works just the way it should :)
Post Reply