Link to home
Start Free TrialLog in
Avatar of xabi
xabi

asked on

Image::Magick crop problem

Hi there:

I'm tryingto crop an image with Image::Magick but not at the TopLeft position. I'm ussing this:

#!/usr/bin/perl
use Image::Magick;

my $imImage = Image::Magick->new;
$imImage->Read("try.gif");
$imImage->Crop(geometry=>"50x20+40+60");
print "Content-type: image/gif\n\n" . $imImage->ImageToBlob(magick=>'gif');

But what I get is an image like this:

|<----------- 90 ----------------->|
              |<------- 50 ------->|

+----------------------------------+ -  
|                                  | ^
|    TRANSPARENT                   | |
|                                  | |
|                                  | |
|             +--------------------+ 80 -
|             |                    | |  ^
|             |   DESIRED CROPPED  | |  |
|             |                    | |  20
|             |       IMAGE        | |  |
|             |                    | v  v
+-------------+--------------------+ -  -

What's wrong with this?

xabi

PS:

- If I use print "Content-type: image/png\n\n" . $imImage->ImageToBlob(magick=>'PNG'); seems to work.
- Explorer renders the cropped image well, but mozilla no.
Avatar of xabi
xabi

ASKER

Sorry but proportional font doesn't show the table OK. Just C&P on any text editor (Ultraedit, textpad, vi, emacs, etc)

xabi
Does it help if you add statement below before first print?
binmode(STDOUT);
Avatar of xabi

ASKER

That's not the problem.

I also did:

print "Content-type: image/gif\n\n";
binmode STDOUT;
$imImage->Write('gif:-');

with the same results.

xabi
Does the problem only occur in Mozilla? It seems to work alright with gif in IE
Is the problem that image don't get cropped, but is displayed as same size as before with the parts that should be cropped as transparent?
Avatar of xabi

ASKER

well, In mozilla image isn't displayed right. Anyway I don't want this crop to use with mozilla, but to use it with cellular phones.
With the cells it down't works (but ericsson).

xabi
>With the cells it down't works (but ericsson).
I don't understand your statement above. What does works and what does not work? What happens when it does not work?
Avatar of xabi

ASKER

This is the Image I get from the script above:

http://xa.bi/files/cropped.gif

and the original is:

http://xa.bi/files/try.gif

xabi

Try the result image in mozilla and in Explorer. In a cellular phone i get the same result as Mozilla.
Nothing has happened on this question in more than 6 weeks. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
PAQ, refund points (a little progress, but ultimately unanswered).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial