I used ImageMagick with this image. This solution requires to know the size of the input image.
Input

The image has 145 pixels horizontally and 200 pixels vertically.
Crop
Crop from the top of the image:
convert -crop 145x145+0+0 -resize 80x80 matrix.jpg thumbnail.jpeg
I used 145x145
in order to extract a square from the original image. +0+0
is the offset of the extracted square, hereby the top left.

Crop with the center of the image:
convert -crop 145x145+0+27 -resize 80x80 matrix.jpg thumbnail.jpeg

The vertical offset is set to 27
because we have to remove 55
(200 - 145
) pixels on top or bottom, so we need to remove 27 (55 ÷ 2
) pixels on the top and 28 pixels on the bottom.
Crop with the bottom of the image:
convert -crop 145x145+0+55 -resize 80x80 matrix.jpg thumbnail.jpeg

Resizing without crop
convert -resize 80x80\! matrix.jpg thumbnail.jpeg
The !
flag (escaped with \!
as suggested in the documentation) after the resize
parameters forces ImageMagick to ignore the aspect ratio.
