Simple Image Cropper

Victor Noagbodji noagbodjivictor at gmail.com
Mon Jul 14 06:18:06 EDT 2008


>Hi,
>
>I am designing a simple image cropper which simply takes an image and use PIL
> to do the cropping.Now in order to do the cropping I simply draw a rectangle on
> the image by dragging the mouse over the image.I then use button press and
> button release events to find the mouse postition and send across the tuple to PIL.
> Everything works fine but what I need is a way to show the user a dotted rectangle
> as he drags across the mouse as in every other standard image editor. I have learnt
> that using gnomecanvas will do that but given my time constraints and the lack of a
> tutorial on pygtk ,I used gtk.image + event box to do the above.
>
>Can someone point to using gnomecanvas in the following directions:
>1.Load an image into the canvas from file as well as pixbuf.
>2.Draw a dotted rectangle
>3.Fire and capture mouse events
>4.Use PIL

>I basically want to know about point 2. Also,will implementing cairo be easy on glade and pygtk?
>
>Regards,
>Abhishek

Hello,

first of all I have no knowledge of pygtk. But after some googling I
have found something that might help you:
http://trac.bjourne.webfactional.com/ GtkImageViewer. It also comes
with Python bindings.

For the crop functionality, check the docs:
http://trac.bjourne.webfactional.com/chrome/common/pygtkimageview-docs/
, there is a function ImageToolSelector
(http://trac.bjourne.webfactional.com/chrome/common/pygtkimageview-docs/gtkimageview.ImageToolSelector-class.html)
that can be customized to make an image cropper.

Well, I hope my little finding can help.

-- 
NOAGBODJI Paul Victor



More information about the Python-list mailing list