# Attachment\_fu and more complicated resizing

**URL:** <https://www.ruby-forum.com/t/attachment-fu-and-more-complicated-resizing/125799>\
**Category:** Rails\
**Created:** [January 12, 2008, 4:31am UTC](https://www.ruby-forum.com/t/attachment-fu-and-more-complicated-resizing/125799 "2008-01-12T04:31:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [January 12, 2008, 4:31am UTC](https://www.ruby-forum.com/t/attachment-fu-and-more-complicated-resizing/125799/1 "2008-01-12T04:31:45Z")

</div>

Not sure if this is the right forum to ask this question but I was  
hoping  
never the less someone might have a suggested solution for me.  
I am presently resizing images that are being uploaded to 200x200. Now,  
no  
matter what the ratio (4:3…) or orientation (horizontal or vertical) I  
am  
making it so the image is always resized to a full 200x200. I am doing  
this  
by either cutting off a little off the top and bottom or off the sides.

Here are the parameters I am presently passing to ‘convert’ on the  
command  
line to get a perfect (almost perfect) 200x200 picture.

convert -size 800x800 #{original\_file} -thumbnail x400 -resize ‘400x\<’  
-resize 50% -gravity center -crop 200x200+0+0 +repage  
#{location\_of\_users\_pictures}/#{self.filename}\_200x200.jpg

Two questions I have for you guys and gals:

- can I simplify how I call convert with the same effect?
- how can I use attachment\_fu out of the box so it does this for me? (I  
am  
going to want to make another thumbnail of a full 50x50 as well)

Your input is greatly appreciated.

Your Friend,

John

–  
John K.  
removed\_email\_address@domain.invalid

Blog: [http://www.kopanas.com](http://www.kopanas.com)  
Conference: [http://www.cusec.net](http://www.cusec.net)  
Twits: [http://www.twitter.com/kopanas](http://www.twitter.com/kopanas)
