In this article, I would like to show a sample code to generate square thumbnail image by using Minimagick
which is a Ruby wrapper for ImageMagic.
Add the gem to your Gemfile & run
In a sample source, I will show you following flow:
- (1) Download Sample Image
- (2) Cut out a square thumbnail image by using Minimagick
- (3) Save Image to file
So, it is operation confirmation.
The above image(640x480) was converted to the following square image(300x300):