Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problem with Read() in PerlMagick

Reply
Thread Tools

Problem with Read() in PerlMagick

 
 
guba@vi-anec.de
Guest
Posts: n/a
 
      04-24-2007
Hello,

I have txt files with paths of image files and
parameter values for image processing operations
in PerlMagick. The structure is like this:

name of the variable without $
variable value

for example:

....
background_jp2_path
E:/ART/IM_Composing/Planes/2004/Tile14/T14-2004_04_30a-1-16T.JP2
crop_width
1222
background_x
2123
background_y
192
background_x_roll
489
....

I wrote a program that reads such txt files,
defines the variables and gets the variable
values like
$background_jp2_path = 'E:/ART/...'
I checked that all variables have the right
values with the print command.

But if I want to read the image file with
$background->Read("$background_jp2_path");
nothing happens!!
The variable has for sure
the right value and the file exists at the
right place which is proven by inserting
the path value by hand
$background->Read("E:/ART/...");
and this works.

Why is the Read()-command not working?
Thank you very much!

 
Reply With Quote
 
 
 
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      04-24-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Hello,
>
> I have txt files with paths of image files and
> parameter values for image processing operations
> in PerlMagick. The structure is like this:
>
> name of the variable without $
> variable value
>
> for example:
>
> ...
> background_jp2_path
> E:/ART/IM_Composing/Planes/2004/Tile14/T14-2004_04_30a-1-16T.JP2
> crop_width
> 1222
> background_x
> 2123
> background_y
> 192
> background_x_roll
> 489
> ...
>
> I wrote a program that reads such txt files,
> defines the variables and gets the variable
> values like
> $background_jp2_path = 'E:/ART/...'
> I checked that all variables have the right
> values with the print command.
>
> But if I want to read the image file with
> $background->Read("$background_jp2_path");


The quotes around $background_jp2_path are not
needed.

> nothing happens!!


Nothing can happen in various ways. We need
that info. Does it hang? Return immediately?
What is the value of $background afterwards?
Does PerlMagick have diagnostics? A debug mode?
What do they say?

> The variable has for sure
> the right value and the file exists at the


Are you sure? Have you checked against a rogue
line feed at the end of th string?

> Why is the Read()-command not working?
> Thank you very much!


You haven't given us any information that could
help answer that question.

Anno
 
Reply With Quote
 
 
 
 
guba@vi-anec.de
Guest
Posts: n/a
 
      04-24-2007
Hello Anno,

thank you for answering.


> Return immediately?


Yes it returns directly. I included a
$background->Write() but nothing is
written so I conclude the object is
empty because nothing was read in
this configuration; everything is working
fine when I checked the functionality
by inserting the path by hand.



> Have you checked against a rogue
> line feed at the end of th string?


This is maybe a starting point because only
the use of file paths are here a problem; all
other variables&values are working. To what
must I pay attention when checking it with
print "$background_jp2_path";
or how else could this be checked?
Thank you very much!

best regards
Guenter



http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de schrieb:
> (E-Mail Removed) <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > Hello,
> >
> > I have txt files with paths of image files and
> > parameter values for image processing operations
> > in PerlMagick. The structure is like this:
> >
> > name of the variable without $
> > variable value
> >
> > for example:
> >
> > ...
> > background_jp2_path
> > E:/ART/IM_Composing/Planes/2004/Tile14/T14-2004_04_30a-1-16T.JP2
> > crop_width
> > 1222
> > background_x
> > 2123
> > background_y
> > 192
> > background_x_roll
> > 489
> > ...
> >
> > I wrote a program that reads such txt files,
> > defines the variables and gets the variable
> > values like
> > $background_jp2_path = 'E:/ART/...'
> > I checked that all variables have the right
> > values with the print command.
> >
> > But if I want to read the image file with
> > $background->Read("$background_jp2_path");

>
> The quotes around $background_jp2_path are not
> needed.
>
> > nothing happens!!

>
> Nothing can happen in various ways. We need
> that info. Does it hang? Return immediately?
> What is the value of $background afterwards?
> Does PerlMagick have diagnostics? A debug mode?
> What do they say?
>
> > The variable has for sure
> > the right value and the file exists at the

>
> Are you sure? Have you checked against a rogue
> line feed at the end of th string?
>
> > Why is the Read()-command not working?
> > Thank you very much!

>
> You haven't given us any information that could
> help answer that question.
>
> Anno


 
Reply With Quote
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      04-24-2007
(E-Mail Removed) <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> (E-Mail Removed)-berlin.de schrieb:


[attribution restored, snippage]

> > Have you checked against a rogue
> > line feed at the end of th string?

>
> This is maybe a starting point because only
> the use of file paths are here a problem; all
> other variables&values are working. To what
> must I pay attention when checking it with
> print "$background_jp2_path";
> or how else could this be checked?


The simplest test would be to chomp() the variable
before using it and see if it works then.

Otherwise, look at the output of

print "$background_jp2_path";

The cursor should be at the end of the line, after the "h".
If it is at the beginning of the next line, the variable
ends with a line feed.

Anno
 
Reply With Quote
 
guba@vi-anec.de
Guest
Posts: n/a
 
      04-27-2007
Hello Anno,

your first suggestion was right it was a rogue line feed.
Thank you!

Guenter

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PerlMagick Cropping Help hoyoul@gmail.com Perl Misc 6 04-21-2005 11:55 PM
PerlMagick, Annotate, and Webdings Aaron Dalton Perl Misc 5 03-27-2005 02:51 AM
perlmagick and image size rossz Perl Misc 7 05-21-2004 06:11 PM
I cann't scale gif with correctly with perlmagick. kenny Perl Misc 7 04-19-2004 09:32 AM
CPANing PerlMagick and it fails Randell D. Perl 0 08-25-2003 04:23 PM



Advertisments