# Image Crop

**URL:** <https://www.ruby-forum.com/t/image-crop/95792>\
**Category:** Rails\
**Created:** [June 13, 2006, 8:42pm UTC](https://www.ruby-forum.com/t/image-crop/95792 "2006-06-13T20:42:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dustin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dustin](https://www.ruby-forum.com/u/dustin)\
**Post date:** [June 13, 2006, 8:42pm UTC](https://www.ruby-forum.com/t/image-crop/95792/1 "2006-06-13T20:42:09Z")

</div>

I want to make a program that will be able to take an image file and  
crop a square at a given coordinate value (X,Y).

I would tell it the X,Y and the size of the crop ie. 350x350. The X,Y  
would be the center of the newly created image.

Thanks for you help

---

<div class="post-metadata">

**Author:** ![dustin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dustin](https://www.ruby-forum.com/u/dustin)\
**Post date:** [June 13, 2006, 8:59pm UTC](https://www.ruby-forum.com/t/image-crop/95792/2 "2006-06-13T20:59:07Z")

</div>

Dustin wrote:

> I want to make a program that will be able to take an image file and  
> crop a square at a given coordinate value (X,Y).
> 
> I would tell it the X,Y and the size of the crop ie. 350x350. The X,Y  
> would be the center of the newly created image.
> 
> Thanks for you help

You need Rmagick [http://rmagick.rubyforge.org/](http://rmagick.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![dustin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@dustin](https://www.ruby-forum.com/u/dustin)\
**Post date:** [March 6, 2009, 3:00pm UTC](https://www.ruby-forum.com/t/image-crop/95792/3 "2009-03-06T15:00:50Z")

</div>

Alex W. wrote:

> Dustin wrote:
> 
> > I want to make a program that will be able to take an image file and  
> > crop a square at a given coordinate value (X,Y).
> > 
> > I would tell it the X,Y and the size of the crop ie. 350x350. The X,Y  
> > would be the center of the newly created image.
> > 
> > Thanks for you help
> 
> You need Rmagick [http://rmagick.rubyforge.org/](http://rmagick.rubyforge.org/)

Try to use the instance method crop  
[http://www.imagemagick.org/RMagick/doc/image1.html#crop](http://www.imagemagick.org/RMagick/doc/image1.html#crop)

Try this for sample

> **[Ruby program to crop an image using rmagick](http://www.genlinux.org/2009/03/ruby-program-to-crop-image-using.html)**
>
> Cropping an image in ruby,then we have to proceed via rmagick.At first install imagemagick and rmagick gem into your system. Whenever we wan...
