ImageMagick - resize image per square

I just started working with ImageMagick. I'm currently trying to convert an image from a file size of almost square size (1411 x 1486) or similar sizes to a square shape, for example, 1024x1024, unfortunately, the resize function does not change the size of the canvas, so I continue to get the number as 1024x982. I am wondering if in any case it is possible to convert a non-square image into a square image using their C ++ libraries.

The reason they are not square is because I convert the GPS positions to UTM and get a square shape, but unfortunately, due to the curved land, they are usually about 400 m from the square ... you may be surprised .

+5
source share
3 answers

You can add! to your geometry like "1024x1024!" to resize or create explicit geometry for the resize method. You may also need to set the aspect flag, though! (I read that some people had to do this, do not explain it, though).

+6
source

Use 1024x1024!will not place a sketch.

Here is a link to what you want http://www.imagemagick.org/Usage/thumbnails/#pad

Command line from the link (to prevent rotting the link):

convert -define jpeg:size=200x200 hatching_orig.jpg -thumbnail '100x100>' \
          -background skyblue -gravity center -extent 100x100 pad_extent.gif
+9
source

, . . ( )

,

convert -resize 1024x1024! *.png


.

mkdir scaled
for %%x in (*.png) do convert -resize 1024x1024! %%x .\scaled\%%x
0
source

All Articles