Converting CMYK Uploads to RGB

88 views
Skip to first unread message

Cameron Booth

unread,
Jul 30, 2008, 4:58:23 PM7/30/08
to Paperclip Plugin
Hey all,

Just moving over to paperclip from attachment_fu (and loving it!!).
One requirement we have is to convert CMYK images that users upload
into RGB ones. I've figured out that the ImageMagick command line flag
for that is '-colorspace RGB', and figured out that I could hack this
change into the Thumbnail.make() method where you build up the
ImageMagick call.

I guess I'm wondering if anybody else needs this kind of
functionality, and if it would be worth me doing a better job of it,
perhaps making it an option that has_attached_file can take?

Or, if anybody has a better way to deal with this, would love to know
that too.

Thanks in advance!

Cameron

minimal

unread,
Aug 13, 2008, 3:03:23 AM8/13/08
to Paperclip Plugin
This hack worked fabulous. Honestly all image upload plugins should do
this conversion. Nothing worse for the user than broken images.

Here's the updated conversion for thumbnail.rb

def transformation_command
scale, crop = @current_geometry.transformation_to(@target_geometry,
crop?)
trans = "-scale \"#{scale}\""
trans << " -crop \"#{crop}\" +repage" if crop
trans << " -colorspace RGB"
trans
end
Reply all
Reply to author
Forward
0 new messages