[Ruby] ImageScience and rotation

Dave Myron dave.myron at contentfree.com
Tue Apr 17 20:51:03 PDT 2007


Evan, if you're out there and have a minute to lend a hand, hit me up with
an email and I can pastie you the two methods as I have them now.

======================================

Or I could hook a brotha up with a patch (attached). It works like this for
the JPG lossless transforms:

  ImageScience.rotate_jpg( input, output, ImageScience::CW )

Or, rotation with any image file (doesn't use FreeImage's JPG lossless
transforms on JPGs)

  ImageScience.with_image( file ) do |img|
    img.rotate( ImageScience::CW ) do |rotated|
      rotated.save "#{file}_rotated.png"
    end
  end

Now, there are several other transforms (both classic and JPG lossless) that
would be interesting to have in ImageScience: horizontal flips, vertical
flips, lossless jpg cropping, etc. But this at least gets me where I need to
be today.

Dave


More information about the Ruby mailing list