File_column Cropping -> image offset information

Hello,

I had a problem cropping images with file_column. These are my settings:

file_column :image, :magick => {
:versions => {
:thumb => “80x80>”,
:medium => “150x150>”,
:square => {
:crop => “1:1”,
:size => “50x50!”
}
},
:geometry => “400x300>”
}

With a square thumbnail i had the following problem; the offset
information of the images wasn’t reset. The i found this in the rmagick
documentation:

http://redux.imagemagick.org/RMagick/doc/image1.html#crop_bang

The |crop| method retains the offset information in the cropped image.
This may cause the image to appear to be surrounded by blank or black
space when viewed with an external viewer. This only occurs when the
image is saved in a format (such as GIF) that saves offset information.
To reset the offset data, add |true| as the last argument to |crop|. For
example,

cropped = img.crop(x, y, width, height, true)

You can add |true| as the last argument with any of the three argument
list formats described above.


so adding ‘,true’ in the file magick_file_column.rb at line 76 solved my
problem

img = img.crop(::Magick::CenterGravity, [img.columns, w].min,
[img.rows, h].min,true)