lundi 10 octobre 2016

Compressing image but keeping same dimensions with Imagemagick

I have a model handling images uploadeded with paperclip and processed with imagemagick.

Here is the model code :

has_attached_file :image, styles: { big: "2000x2000", small: "1000x1000", thumb: "250x250"}
validates_attachment :image, content_type: { content_type: ["image/jpeg", "image/gif", "image/png"] }

I use all those different styles but I also use the original style. Though the original size may be very big, some pictures are above 15 Mo.

I would like to compress the original style yet not knowing exactly what size it is, sometimes image is cropped and the 3:2 ratio is not respected.

I found this thread : Reducing the file size of a very large images, without changing the image dimensions yet not adapted to Rails environment.

Aucun commentaire:

Enregistrer un commentaire