Forum archive 2000-2006

Edgar Fisher - Size variable in images

Edgar Fisher - Size variable in images

by Arnold Pizer -
Number of replies: 0
inactiveTopicSize variable in images topic started 6/15/2005; 7:18:30 PM
last post 6/16/2005; 12:15:33 AM
userEdgar Fisher - Size variable in images  blueArrow
6/15/2005; 7:18:30 PM (reads: 925, responses: 3)
When I use the function that gets the size from an image ($pic->size();) I get an answer that I store in an array. The documentation says that it returns two values. Instead it returns an array of undetermined size. The width and height are accessed by a double index. ie $width = $val[0][0] and $height = $val[0][1]. I don't know what is is $val[1]* or how large it is. Any clarification would be useful.

<| Post or View Comments |>

userMichael Gage - Re: Size variable in images  blueArrow
6/15/2005; 8:39:57 PM (reads: 1215, responses: 0)
I'm not sure what kind of image you have. The WWPlot object (generated for graphing functions) is described at



($horizontal_pixels, $vertical_pixels) = $graph ->size();
Reads the size of the graph image in pixels. This cannot be reset.
It is defined by the new constructor and cannot be changed.

[ Later: Oops. I just looked at the code and $graph->size() returns a pointer to an array, not an array, so the code above should be

($horizontal_pixels, $vertical_pixels) = @{$graph ->size()};
I'll get the documentation fixed. ]

WWPlot is build on the module and our link seems to be broken at the moment, but a quick google search shows documentation at I didn't see a size method there.

It will clarify matters if you tell us how the object $pic was created.

<| Post or View Comments |>

userMichael Gage - Re: Size variable in images  blueArrow
6/15/2005; 10:16:31 PM (reads: 1207, responses: 0)
I have a theory as to what may have happened. Here is my test:
$pt = [34, 56];
@val= $pt; # this is where you used $pic->size();
print $val[0]; # gives ARRAY(0x801180)
print $val[0][0]; # gives 34
print $val[0][1]; # gives 56
print $val[1]; # gives an undefined value.

I'm pretty sure that you ended up defining a one element array. The element was
a pointer to an array pair. In perl $val[0][0] is equivalent to $val[0]->[0]. All of the indices
AFTER the first one can be thought of as being preceeded by arrows.

Hope this helps.

Take care,


<| Post or View Comments |>

userEdgar Fisher - Re: Size variable in images  blueArrow
6/16/2005; 12:15:33 AM (reads: 1199, responses: 0)
Thank you very much. That answers my question and eases my concern that somehow I was playing with more than what I wanted (frequently dangerous).

<| Post or View Comments |>