Here's an example of using image_science to crop the image:

Shoes.setup do
        gem 'image_science'
        File.chmod (0755, ENV['INLINEDIR'] = Dir.tmpdir)
end

Shoes.app do
        require 'tempfile'
        require 'image_science'
        
        image_path = 'nav_logo4.png'
        
        ImageScience.with_image image_path do |image|
                image.with_crop 10, 10, 50, 50 do |cropped|
                        image_path = Tempfile.new('cropped').path
                        cropped.save image_path
                end
        end
        
        image image_path
end

Kyle

On Mar 4, 2009, at 2:35 PM, Alexander Rakoczy wrote:

You could use Displace or Move.

http://help.shoooes.net/Position.html

Also, RMagick is a really good gem for image manipulation.

On Wed, Mar 4, 2009 at 05:30, Rolando Abarca <[email protected]> wrote:
Mmm... interesting. I think this might actually work.
But, how do you move the background to simulate the crop? I tried a negative
value for left and top, but that doesn't seem to work...

On Mar 4, 2009, at 1:58 AM, Evan Farrar wrote:

One thing you might try is to use the image as a background for a
stack that has a fixed width:

stack(:height => 100, :width => 100) do
 background "a_big_image.jpg"
end


On Tue, Mar 3, 2009 at 8:19 PM, Rolando Abarca <[email protected]> wrote:

Hi all,
I'm just starting with shoes, and after searching the mailing list
archives I'm asking here: is there a way to crop an image? Maybe using masks? I want to copy a portion of an image and place it on another stack...

thanks for any help :-)
--
Rolando Abarca M.


Regards,
--
Rolando Abarca M.








--
alexander rakoczy
http://arakoczy.com

Reply via email to