user3622981
user3622981

Reputation: 131

Resize canvas by half imagemagick

How to resize a image of variable sizes to half of its current size?

That is :
30x30 to 15x15
40x40 to 20x20
60x60 to 30x30

Gravity:Top-Left

Upvotes: 2

Views: 3410

Answers (2)

If you work with the GUI, clicking View > Half Size (or resize for other proportions) and View > Apply. After that, you save your image. Through the console, adding the following arguments:

$ display -write ./output.png -resize 50% original.png

Upvotes: 2

Mark Setchell
Mark Setchell

Reputation: 208052

Updated Yet Again

convert input.png -extent 50% -background none output.png

Updated Again

Maybe you mean this:

convert input.jpg -extent 50% output.jpg

Updated Answer

Maybe you mean cropping out the centre of the image like this:

convert input.jpg -gravity center -crop 50% output.jpg

Original Answer

Like this:

identify input.jpg    # Check dimensions of input image
input.jpg JPEG 304x304 304x304+0+0 8-bit sRGB 37KB 0.000u 0:00.000

# Convert the image to half its size
convert input.jpg -resize 50% output.jpg

identify output.jpg   # Check dimensions of output image
output.jpg JPEG 152x152 152x152+0+0 8-bit sRGB 20.2KB 0.000u 0:00.000    

Upvotes: 7

Related Questions