Page 1 of 1

Command-line image manipulation

Posted: 2008-04-23T16:24:16-07:00
by sect0id
I currently use this for shrinking image.png to a smaller dimension of 110x120.
convert -resize '110x120!' image.png test2.png

How would I overlay test2.png onto the center of a transparent 128x128 image or increase test2.png's dimensions to 128x128, while keeping its original dimensions and having it centered, with a transparent background?

Not necessary to have this integrated into the command above but would be preferable. :D

Re: Command-line image manipulation

Posted: 2008-04-23T17:36:02-07:00
by el_supremo
This should do it.

Code: Select all

convert image.png -resize "110x120!" -size 128x128 xc:none +swap -gravity center -composite test2.png
Pete

Re: Command-line image manipulation

Posted: 2008-04-23T18:54:54-07:00
by sect0id
Aside from having to swap " for ' that works great, thanks :D

Re: Command-line image manipulation

Posted: 2008-04-24T16:23:19-07:00
by sect0id
Does ImageMagick support file piping to/from the convert command? (to eliminate the need for a temp file)

Re: Command-line image manipulation

Posted: 2008-04-24T17:09:16-07:00
by magick

Re: Command-line image manipulation

Posted: 2008-05-20T20:16:00-07:00
by anthony
More specifically the second section on "File Handling" Reading and saving.

Code: Select all

    type:-
will read or write to stdin/stdout an image of the type given. When reading the type can usally be skipped as IM can usally figure it out on the fly.

Code: Select all

   convert .....  miff:- | display - 
is actually quite a common command to display rather than save the results of a command.