Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

magick image resize

I am using magick library in R.

I am using the following command but it is not working correctly

shoe <- image_read('F:/photo.jpg')
image_scale(shoe,'382x509')

format width height colorspace filesize
JPEG   382    460       sRGB        0

The width is set to 382 but not height. so I set height by following command

image_scale(shoe,'X509')

format width height colorspace filesize
JPEG   423    509       sRGB        0

Now it changed the width. Is there any way to turn off the aspect ratio while resizing?

like image 705
Grv Avatar asked Mar 30 '17 13:03

Grv


People also ask

How do I resize an image in ImageMagick?

To resize an image to specific dimensions, use the convert command with an input file, the -resize parameter, your preferred dimensions, and an output filename: convert original. png -resize 100x100 new. png.

Is ImageMagick good?

If you're not sure what ImageMagick is, it's one of the greatest tools you could have on your computer, to manipulate images and a few other types of files.

Is GraphicsMagick better than ImageMagick?

GraphicsMagick was considerably executing image processing operations faster than ImageMagick 6.5. 8-10. You can also check it by doing some type of processing on both of the software one by one.


1 Answers

Reading the original documentation here brings the solution:

image_scale(shoe,"382x509!")
#  format width height colorspace filesize
#1   JPEG   382    509       sRGB        0
like image 82
J_F Avatar answered Sep 23 '22 22:09

J_F