Hi El-abid,
Yes there are libraries and different methods to help you with image
manipulation.
We can achieve this by using ImageMagick.
ImageMagick is a software suite to create, edit, compose, or convert
bitmap images.
We can use ImageMagick to re-size, flip, mirror, rotate, distort, shear
and transform images, adjust image colors, apply various special
effects, or draw text, lines, polygons, ellipses and Bézier curves.
You can read full article on <a
href="
http://www.railscarma.com/blog/technical-articles/image-manipulation/">Railscarma's
Blog.</a>