picture size

Robert Brenstein rjb at rz.uni-potsdam.de
Sun May 5 17:29:00 EDT 2002


>Hi Robert,
>
>>Robert Brenstein wrote:
>>
>>>Is there a simple way to get the pixel sizes of images (jpeg and gif)
>>>in Metacard? In HyperCard, I use the picture command to open them
>>>invisibly (this is important), then fetch the size. The picture
>>>command does not seem to be part of MetaCard.
>>>
>>>picture (fPath & fName),,,false
>>>get pictureheight of window fName
>>>get picturewidth of window fName
>>>close window fName
>>
>>MetaCard's syntax is arguably more self-consistent with the priciples of
>>HyperTalk on this one.  Rather than relying on an external MC has native
>>image objects, with properties that can be querried and set like buttons and
>>fields.
>>
>>In this case, the property you're looking for is the fileName of the image
>>object:
>>
>>   set the filename of image 1 to tMyPath
>>   get the rect of image 1
>>
>>If you don't already have an image object on the card, you can also import
>>image files into a new image object using the import command.
>>
>>--
>>  Richard Gaskin
>
>Richard is right, as always ;-)
>
>But maybe these props could be of any more help to you.
>
>the formattedheight of image "xxx"
>the formattedwidth of image "xxx"
>
>This will return the original height and width of an image.
>
>
>Regards
>
>Klaus Major
>k_major at osnabrueck.netsurf.de
>

Thanks guys. This is exactly what I need. I did not catch that the 
filename property is actually a filepath that allows me to swap the 
image content dynamically (and the image object resizes accordingly).

I do not want to import these images. These are external files and I 
just need to acquire their sizes dynamically. The MC version of my HC 
script is thus (having already created an invisible image object):

set the filename of image "tmp" to fpath
get the formattedheight of image "tmp"
get the formattedwidth of image "tmp"
set the filename of image "tmp" to empty

Robert



More information about the metacard mailing list