[BangPypers] Questions regarding Image cropping

Noufal Ibrahim noufal at gmail.com
Sun Mar 1 09:02:11 CET 2009


Hello,

On Sun, Mar 1, 2009 at 1:25 PM, Arunabha Adhikari
<arunabha.adhikari at gmail.com> wrote:
> Dear friends,
>
> I am a beginner in Python programming. I am not a computer professional I am
> a physicist. I was trying to write a code in python for my own research
> which involves a little image processing. All I need to do is to display an
> image and then select a region of interest using my mouse and finally crop
> out the selected region. I can do this in Matlab using the ginput()
> function. I tried using PIL. But I find that after I issue the command
> Image.show(), the image is displayed but then the program halts there unless
> I exit from the image window. Is there any way to implement what I was
> planning. Do I need to download any other module? Please advise.

If you want to do image cropping non-interactively (ie. using a script
or someting) I would recommend that you use something like 'convert'
that comes with the ImageMagick utilites. You can say something like
  convert original.jpg -crop <specificiation>  output.jpg
 and you'll get what you want.

If you want to interactively decide what piece you want to crop, I
think it would be better to use a graphics editing program like the
GIMP.

If you're trying to implement a graphics editor in Python, I think it
will be quite hard. Maybe if you can explain your requirements a
little more, I might be able to help. I've used PIL a few years ago
and have some memory of what it provides.

Ta ta.
-- 
~noufal


More information about the BangPypers mailing list