search

Navigation

Blog Entry

heroku paperclip imagemagick headache

Posted Friday 12/04/09 @ 03:13AM

Tags: rails, ruby, heroku, paperclip, imagemagick

I am posting this little tip in the hope it will save someone a big headache at some point.

If you happen to be using heroku as a hosting solution, and are utilizing imagemagick (Probably with paperclip) Then this might help you out.

Heroku is using an older version of imagemagick, and there are a few features in this version, which do not behave as they are currently documented as behaving. (at least not without some massive googling).

The version of imagemagick heroku is running as of 12/03/2009:
ImageMagick 6.2.4.5

But according to their support they are soon upgrading to:
ImageMagick 6.3.7.9

The issue we had was with the ‘extent’ command.

Extent: Direct Image Size Adjustment

We were using extent to center an image within a transparent padding.

So, come to find out, the current functionality of extent, is a bit different from what it was in v. 6.2.4.5.

And the equivalent in that version is:

-bordercolor transparent -border 50 -gravity center -crop 100×100+0+0 +repage

This will center an image onto a 100×100 transparent background.

and to scale up it’s simply a matter of making the border half of the total size. eg: 100×100 has a border of 50, 300×300 has a border of 150.

annnnnnnndddddddddd Tada!


Comments

Andrea on Monday 12/14/09 @ 11:06AM

Do You know when they upgrade to version 6.3.7.9? I have a problem with "-crop". I am following the screencast 182 of Rayan Bates. Local works perfectly while on Heroku cropping does not preserve the ratio Crop_command is something like " -crop '#{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}'"... any suggestions?

Jesse on Tuesday 12/15/09 @ 02:14AM

Hello Andrea, I'm sorry to say I don't know when they are performing the upgrade. Their support said, they were 'In the process of planning the upgrade', That's pretty helpful, huh? :) I'd shoot them a ticket to see if there has been anymore progress with the upgrade. What is the intended outcome of your crop? To save a cropped area of the image, in the original size of the area or, have the cropped area the same size as the original image ?

Andrea on Tuesday 12/15/09 @ 09:42AM

When I select an area (100x100) of an image ( 222x317 ratio 0,70 ), have a new saved image with the original ratio ( 100x143 ratio 0,69 ). This image should clarify the process http://xr.com/a9vm (not look at the subject of the image ;o) thanks in advance...

Thomas on Monday 01/17/11 @ 05:10PM

I have to go with Ultra Web Hosting. if you want to know my reasons you can stop by and check out our January Review. Great blog.

game camera on Saturday 09/24/11 @ 08:03AM

great post, I will follow you.

WebHosting on Sunday 03/20/11 @ 11:58PM

Hahhaha.. I'm sorry, I know nothing is funny here, I just laughed at the last part. Liked the way how you presented this information. This will really serve as a great guide for those who are experiencing the same problem as yours. Great job!

Partnersuche on Tuesday 05/31/11 @ 08:11PM

I have tested on a LAMP and it didn't work. I don't know why - but it finish without a error-message.

Post a new comment

Fields marked with * are required.