I want to create multiple versions like :large, :medium, :small. No Problem so far. But how are these methods invoked?
A simple test:
version :large do
process :resize_to_fit => [1024, 1024]
end
version :large2, :from_version=>:large do
process :resize_to_fit => [1024, 1024]
end
results into two different sized files. I would assume the versions to be identic. So I guess :large2 is re-reading the file (large) from disk into RMagick?
How can I do it "right"? (I would use the same RMagick-Object to create the versions) I want to try to keep on the carriewave-way and not to do too much by myself.
Thanks and regards for any hint, Phil.
An example to create 3 typical image file sizes with Carrierwave using MiniMagick in the uploader.rb file
MiniMagick efficiency considerations when creating different sized images
MiniMagick docs suggest for processing efficiency to start with the largest resolution size and work down, cascading the re-sized files instead of starting with the large one each time as a base file converted (https://github.com/carrierwaveuploader/carrierwave).
You do this with the :from_version directive shown in the example above.
MiniMagick resize_to_fill versus resize_to_fit, aspect ratios, scaling
MiniMagick gives you various image manipulation options. I find resize_to_fill works for my purposes better than resize_to_fit, but your mileage may vary. There are considerations when choosing an image re-sizing option, especially in the case where the aspect ration of the original image does not match that of the resize target image.
Here's the ImageMagick spec with all of the image magic that MiniMagick uses: http://www.imagemagick.org/Usage/resize/#resize
MiniMagick gemspec https://github.com/minimagick/minimagick