i am currently writing ascript which uses “image info” to extract all the information from an image (iptc data, icc data and finder info) and places it in a filemaker database.
Can anybody help me to obtain an image preview/thumbnail which can be placed into the database.
I have got this to work using graphic converter but this has to open the image which will take too long. I only need a suggestion of the image for keywording purposes. the largest icon view in the finder would be perfect.
I have also tried cutting and pasting from the application “image info” as it has an image preview window, but have failed to get this to work.
set folderPath to (choose folder with prompt "Choose a folder with pictures to import�")
set fileList to list folder folderPath
set pictureCount to 0
--create a new record for each picture
repeat with pictureFileName in fileList
tell me to set pictureFileRef to (folderPath & pictureFileName as string)
if folder of (info for (alias pictureFileRef)) = false then
--selects only jpegs as that is all I deal with
if file type of (info for (alias pictureFileRef)) is "jpeg" then
tell application "Image Info"
open alias pictureFileRef
set extendedinfo to Image Info for alias pictureFileRef return dimensions as inches with extended info
set extendedinfopixel to Image Info for alias pictureFileRef return dimensions as pixels with extended info
set extendedinfocm to Image Info for alias pictureFileRef return dimensions as centimeters with extended info
set displayinfo to display info for alias pictureFileRef
set finderinfo to Image Info for alias pictureFileRef with finder file info
set iccinfo to ICC Info for alias pictureFileRef
set imagewidthinch to image width of extendedinfo
set imageheightinch to image height of extendedinfo
set imagewidthcm to image width of extendedinfocm
set imageheightcm to image height of extendedinfocm
set imagewidthpixel to image width of extendedinfopixel
set imageheightpixel to image height of extendedinfopixel
set imageresolution to image resolution of extendedinfo
set imageformat to image format of extendedinfo
set imagesize to image file size of finderinfo
set imagecreator to image creator of finderinfo
set imagefilepath to image file path of finderinfo
set imagecreated to image created of finderinfo
set iccprofilename to ICC profile name of iccinfo
-- next bit doesn't work!
--copy image preview to the clipboard
end tell
tell application "FileMaker Pro"
activate
tell database "New_Image"
set newRecord to create record
go to newRecord
set cell "image_ref" of newRecord to pictureFileName
set cell "image_width_inch" of newRecord to imagewidthinch
set cell "image_height_inch" of newRecord to imageheightinch
set cell "image_width_cm" of newRecord to imagewidthcm
set cell "image_height_cm" of newRecord to imageheightcm
set cell "image_width_pixel" of newRecord to imagewidthpixel
set cell "image_height_pixel" of newRecord to imageheightpixel
set cell "image_resolution" of newRecord to imageresolution
set cell "image_format" of newRecord to imageformat
set cell "image_file_size" of newRecord to imagesize
set cell "image_creator" of newRecord to imagecreator
set cell "path_to_hires" of newRecord to imagefilepath
set cell "icc_profile_name" of newRecord to iccprofilename
set cell "creation_date" of newRecord to imagecreated
-- next bit doesn't work!
--"image_preview" is a container field
--go to cell "image_preview" of newRecord
--paste it
set pictureCount to pictureCount + 1
end tell
end tell
end if
end if
end repeat
-- display number of pictures found, also displays error if there are no images found
tell me to activate
if pictureCount = 0 then
display dialog "There are no files that I can import, try with a folder with Jpegs in " & folderPath
else
display dialog "Number of pictures imported using file reference: " & pictureCount
end if