jnicklas/carrierwave — Issue #579: Using :process output for versions
Author: JamesHarrison
Created: 2012-01-01 22:52:17+00:00
State: open

As far as I can tell, doing something like:

process :convert_svg

def convert_svg
manipulate! do |img|
if img[:format] == 'SVG'
img.format 'PNG'
end
img
end
end

def filename
"#{secure_token}.#{file.extension.gsub("svg","PNG").gsub("SVG","PNG")}" if original_filename
end

and then doing:

version :thumb do
process :resize_to_limit_with_gif_fix => [150, 150]
end

will result in the version being generated (using manipulate!) from the SVG version of the file rather than the PNG version. Which is awkward, because SVG resize operations take forever (not to mention the slight detail of the 2.4 gigabytes of RAM a simple 48kb SVG requires to be resized). What I'm trying to do is have the SVG converted to a PNG (takes 5 seconds and nearly no RAM), which works, but then have the versions use the PNG version of the image for their operations (which amount to a resize, or in the case of GIFs, coalesce/resize/optimize). I'm using MiniMagick throughout.

Is this functionality present in CarrierWave and I'm just overlooking it, or is this not something that can be done at present?