giving filename in PERLMAGICK

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

giving filename in PERLMAGICK

Post 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 :(
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: giving filename in PERLMAGICK

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: giving filename in PERLMAGICK

Post by sin »

Thank you.

The resize part is working fine....can you please tell me the syntax to ask user the input in perlmagick?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: giving filename in PERLMAGICK

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply