Re: Searching for RGB images in a Quark doc
Re: Searching for RGB images in a Quark doc
- Subject: Re: Searching for RGB images in a Quark doc
- From: "Gary (Lists)" <email@hidden>
- Date: Thu, 22 Jun 2006 23:10:45 -0400
"email@hidden" wrote:
> Does anyone have a script that can search the images of a Quark doc and flag
> any in the RGB colour space?
Do the images live inside Quark, or in the file system (and are referenced
by Quark)?
If Quark doesn't provide for such a task, then since we're on the subject of
'sips', you can use that tool and/or Image Events.
In ImEv for example, you can simply retrieve the 'properties of' a file.
This record contains properties for both 'bit depth' and 'color space'
Now, for some reason, I find these two values very difficult to coerce to
string. I did not explore possible conflicts and have lived with a handler
that over-coerces to deal with these values.
I hope that maybe there is just some small issue that I did not have time to
explore back then, and that you will have better luck with those two
properties that I did (context is everything, I this handler was called from
a lengthy Smile dialog script, and so I may have introduced my own problems
by calling this handler in a context where I created the conflict.
But, if it might help, here is one of my own brand of
Awful-But-Did-the-Job-Once Handlers. It goes exactly like this:
on getImagePropsImgEvt(f) -- alias
try
tell application "Image Events"
launch
-- open the image file
set img to open f
-- extract the properties record
set the imgPropsRecord to the properties of img
-- assemble variables, in this round-about way,
-- because it seems difficult to refer to some of
-- these properties because of some name conflicts,
-- but where, I do not know...yet
-- arrgggh!!! make a string, would you?
set bitDepth to (imgPropsRecord's bit depth as string)
-- hard to coerce!! why?
set bitDepth to "" & (bitDepth as string)
set fType to imgPropsRecord's file type
set fType to "" & fType
set fColors to imgPropsRecord's color space
set fColors to "" & (fColors as string) -- hard to coerce!! why?
set fRes to imgPropsRecord's resolution
set fClass to imgPropsRecord's class
set fClass to "" & fClass
set fDims to imgPropsRecord's dimensions
set thisItemsName to imgPropsRecord's name
-- final assembly of the record
set theImgProps to {imgBitDepthStr:(bitDepth as string),
imgFileType:(fType as string), imgEvtColorSpace:(fColors as string),
imgResDPI:fRes, imgClass:(fClass as string), imgDim:fDims,
imgFileName:(thisItemsName as string)}
-- Example result...
-- {imgBitDepthStr:"millions of colors", imgFileType:"GIF",
imgResDPI:{72.0, 72.0}, imgClass:"image", imgDim:{40.0, 40.0},
imgFileName:"icon_gray_detail_40x40.gif", imgEvtColorSpace:"RGB"}
--
-- purge the open image data
close img
end tell
return theImgProps -- record
on error errMsg_ number errNum_
return {eN:errNum_, eM:errMsg_}
end try
end getImagePropsImgEvt
HTH...nasty as it is...
--
Gary
...out the door in less than 24 hours...beach, here I come...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden