Understanding Image Sizes, Before And Display

Sannyasin Brahmanathaswami brahma at hindu.org
Sat Dec 22 19:14:11 EST 2018


Well after all these years, I want to know the original width and height of reference image by it "content" and not as it "image data" which will change if the image was resize. So let say it reference brand new image  

answer file "Select the image you wish to view:" with type "JPEG Images|jpg|JPEG"

# the filename of an image to that. Let say its 250 X 150 pixels 
# resize this image  to something "stupid" like 100 x100

How does one query, at time point, the original height and width?

I looked through to dictionary, and don't see a way.  I course of the mini-study I found "prepare"

on mouseup
      answer file "Select the image you wish to view:" with type "JPEG Images|jpg|JPEG"
      if it is "Cancel" then
         exit to top
      else
         put it into tFileName
      end if
      prepare image file tFileName
      put the width of image file tFilename  # error here
end mouseup

This entry seems a little lean.... 

prepare 

"...Then access the image and display it as needed on your stack. Since the image is already cached into memory, it displays instantly."

One would think that since it is cached, you can get its rect?

What am missing? Do have to create a new image to get it original size?

===========

The location and name of the image file you want to load and
decompress into the image data cache. Since the image data cache is 
keyed on the absolute filename, any images which reference that file
are able to use the data from the cache. This assumes that the cache has
not been flushed.

Description
Use the prepare image command to speed up execution when 
showing image data.

Use the prepare image command to preload an image at some time 
before it is needed. Then access the image and display it as needed on 
your stack. Since the image is already cached into memory, it displays 
instantly.









More information about the Use-livecode mailing list