Jump to content

How to show the attributes of an image?

This topic is 6603 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've set up a container field that displays a picture. I'd like another field to display the attributes of the file referenced in that container field. I'm after the resolution pixels tall x pixels wide, and other information if it is available. Is this possible? Thanks for any advice.


Link to comment
Share on other sites

Thanks very much for the help.

I did test out the GetAsText function on a normal container field with a manually inserted picture and I was able to get the resolution as you described.

However, I neglected to say that I am using the "image:" directive to display the picture using a calculation field, expressing the result as a container. The formula I'm using to create the image reference is "image:" & "new jpgs/" & product_id & ".jpg". The calculation field I'm using is named "picture_calc" with the output being a 'container'.

Therefore when I use the 'GetAsText' function on the 'picture_calc' field, I just get the same evaluated image directive string back, for example "image:new jpgs/2503-1.jpg".

Is there a way to get what I want now that I've provided more information? Thanks for all the help.


Link to comment
Share on other sites

There is a way to get it with AppleScript (at least in Panther, probably in Jaguar), using the built-in Image Events application (runs in background). This is an example of what it can get (try from Script Editor):

set theImage to choose file

tell application "Finder"

set theName to name of theImage

set fileSize to ((size of theImage) div 1024)

set creatorType to creator type of theImage

-- or "file creator of (info for theImage)"

set fileType to file type of theImage as string

if fileType is "missing value" then

set fileType to name extension of (theImage)

end if

set theKind to kind of theImage

end tell

tell application "Image Events"


set thisImage to open theImage


set theSize to dimensions of thisImage

set theHeight to (item 2 of theSize)

set theWidth to (item 1 of theSize)

set theRes to resolution of thisImage

set theDepth to bit depth of thisImage

set theSpace to color space of thisImage

end try

end tell

-- bit depth is kind of problematic

The problem is then translating the "relative path" you have in FileMaker into a full Mac alias (or file) path (which is what "choose file" returns).

This can be done by parsing the database folder path out of Get (filepath), translating it to a Mac path, then adding the relative path (also translated). These can be Unstored (so as not to bloat).

myFolder =

Substitute( Left(Get(FilePath); Position(Get(FilePath); "/"; 1; PatternCount(Get(FilePath); "/"))); ["/"; ":"]; ["file::"; ""] )

imageFile =

myFolder & "images:" & File name field

"images:" being the relative folder path (if all images are in the same folder; otherwise use a field).

So, setting the file path would look something like this (instead of the choose file line):

tell application "FileMaker Pro" -- comment out in FileMaker

set imageFile to cell "imageFile"

set theImage to imageFile as alias

rest of script

end tell -- comment out in FileMaker

Link to comment
Share on other sites

This topic is 6603 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.