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.
Command-line image manipulation
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Command-line image manipulation
This should do it.
Pete
Code: Select all
convert image.png -resize "110x120!" -size 128x128 xc:none +swap -gravity center -composite test2.png
Re: Command-line image manipulation
Aside from having to swap " for ' that works great, thanks
Re: Command-line image manipulation
Does ImageMagick support file piping to/from the convert command? (to eliminate the need for a temp file)
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Command-line image manipulation
More specifically the second section on "File Handling" Reading and saving.
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.
is actually quite a common command to display rather than save the results of a command.
Code: Select all
type:-
Code: Select all
convert ..... miff:- | display -
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/