Page 1 of 1

giving filename in PERLMAGICK

Posted: 2011-08-27T02:46:19-07:00
by sin
hi,

How can we ask the user to enter the image file in perlmagick?

like in perl,
we can ask...
print "please enter the input file ";

Is there a option like this in perlmagick to take the input from the user in reading it??

Also please tell me the command for resizing an image.
I'm writing like this:

$image->Resize(geometry => '$a x $y');
where $a and $y are defined earlier in the code.
but this is nt working :(

Re: giving filename in PERLMAGICK

Posted: 2011-08-29T00:53:56-07:00
by anthony
Asking the user about something is done in the perl part, not the imagemagick part. It has nothing to do with IM.

That resize method should also work just fine.

However be warned that the perl (or other) API's may not follow the Comannd Line API, in attempting to preserve an images aspect ratio. Basically test and make sure it does what you expect first.

Re: giving filename in PERLMAGICK

Posted: 2011-08-29T21:48:49-07:00
by sin
Thank you.

The resize part is working fine....can you please tell me the syntax to ask user the input in perlmagick?

Re: giving filename in PERLMAGICK

Posted: 2011-08-30T16:48:08-07:00
by anthony
Reading input is reading a line either from normal STDIN.
or if you are security concious (passwords), or are using STDIN for a file, then open "/dev/tty" and read a line from it.

Code: Select all

#/usr/bin/perl
#
#
print "Type something: ";
my $input = <STDIN>;
print "the user typed: $input\n";
As I said the ImageMagick module is not needed for input in perl.