• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1124
  • Last Modified:

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.
0
xabi
Asked:
xabi
1 Solution
 
xabiAuthor Commented:
Sorry but proportional font doesn't show the table OK. Just C&P on any text editor (Ultraedit, textpad, vi, emacs, etc)

xabi
0
 
rj2Commented:
Does it help if you add statement below before first print?
binmode(STDOUT);
0
 
xabiAuthor Commented:
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
rj2Commented:
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?
0
 
xabiAuthor Commented:
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
0
 
rj2Commented:
>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?
0
 
xabiAuthor Commented:
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.
0
 
jmcgOwnerCommented:
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
0
 
Computer101Commented:
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now