How to extract Resolution and Color Mode of an image on Quar

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)
Post Reply
cits
Posts: 0
Joined: 11 Jun 2008, 08:14

How to extract Resolution and Color Mode of an image on Quar

Post by cits » 11 Jun 2008, 03:08

I learnt from the forum that we can use properties of image file to obtain info for the image.But i cannot find the info of Resolution, and also the Color Mode such as RGB or CMYK.Can anyone pls advise! Thanks in advance.

scottws
Posts: 38
Joined: 28 May 2004, 15:52

How to extract Resolution and Color Mode of an image on Quar

Post by scottws » 11 Jun 2008, 03:43

Utilities->Usage, select image->More Information

cits
Posts: 0
Joined: 11 Jun 2008, 08:14

How to extract Resolution and Color Mode of an image on Quar

Post by cits » 11 Jun 2008, 16:42

My apology that I didn't express my question correctly.How can I extract Resolution and Color Mode of an image on Quark document using AppleScript?

Scripting_Ace
Posts: 684
Joined: 29 Jun 2004, 13:14

How to extract Resolution and Color Mode of an image on Quar

Post by Scripting_Ace » 11 Jun 2008, 17:55

cits wrote:My apology that I didn't express my question correctly.How can I extract Resolution and Color Mode of an image on Quark document using AppleScript?

Yes you did, someone just forgot to take notice of the forum he was repling in [:P]
You cannot do waht you want in Quark. You have to use a third party application for that. You will need qaurk to tell you the scale of the imported picture as well as its path. Then, in Graphic Converter, Photoshop, etc. you will open the picture and get its resolution. You will have to calculate the effective resolution for yourself.
I believe Quark has that information somewhere but it os not exposed to AppleScript (yet?)

Hope this helps!

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

How to extract Resolution and Color Mode of an image on Quar

Post by Jean-Marie Schwartz » 12 Jun 2008, 05:46

Here is a code that will get info from Image Events. It won't get the resolution as such. (Can't remember if it's actually reachable or not in IE, maybe you can search further on...)

Code: Select all

tell application "QuarkXPress Passport"activatedelay 1tell document 1set this_file to (file path of image 1 of current box) as aliastrytell application "Image Events"launch-- open the image file set this_image to open this_filetryset EspaceCol to color space of this_image as stringset type_image to file type of this_image as stringset dimensions_image to dimensions of this_image as listset largeur to (item 1 of dimensions_image as integer) as stringset hauteur to (item 2 of dimensions_image as integer) as stringend tryclose this_imageend tellon error error_messagedisplay dialog error_messageend tryend tellbeep 2display dialog "Color Space: " & EspaceCol & return & "File type: " & type_image & return & "Dimensions (in pixels):" & return & tab & "width = " & largeur & return & tab & "height = " & hauteurend tell
EDIT -> What a mess without a regular editor! Is it sth due to Safari only? Grrr!

scottws
Posts: 38
Joined: 28 May 2004, 15:52

How to extract Resolution and Color Mode of an image on Quar

Post by scottws » 12 Jun 2008, 07:31

My bad - I went to Posts You Have Not Read, and the forum section (e.g., Applescript) is not listed with the new format.

Scripting_Ace
Posts: 684
Joined: 29 Jun 2004, 13:14

How to extract Resolution and Color Mode of an image on Quar

Post by Scripting_Ace » 12 Jun 2008, 07:50

Jean-Marie Schwartz wrote:EDIT -> What a mess without a regular editor! Is it sth due to Safari only? Grrr!


It would appear so Jean-Marie, see how good it looks when you use these forums with Firefox!


001tell application "QuarkXPress Passport"
002activate
003delay 1
004tell [b]document[b] 1
005[b]set[b] [b]this_file[b] [b]to[b] ([b]file path[b] [b]of[b] [b]image[b] 1[b] [b]of[b] [b]current box[b]) [b]as[b] [b]alias
006[b]try
007[b]tell[b] [b]application[b] "Image Events[b]"
008[b]launch
009[b]-- open the image file
010[b]set[b] [b]this_image[b] [b]to[b] [b]open[b] [b]this_file
011[b]try
012[b]set[b] [b]EspaceCol[b] [b]to[b] [b]color space[b] [b]of[b] [b]this_image[b] [b]as[b] [b]string
013[b]set[b] [b]type_image[b] [b]to[b] [b]file type[b] [b]of[b] [b]this_image[b] [b]as[b] [b]string
014[b]set[b] [b]dimensions_image[b] [b]to[b] [b]dimensions[b] [b]of[b] [b]this_image[b] [b]as[b] [b]list
015[b]set[b] [b]largeur[b] [b]to[b] ([b]item1 of dimensions_image as integer) as string016set hauteur to (item 2 of dimensions_image as integer) as string017end try018019close this_image020end tell021on error error_message022display dialog error_message023end try024end tell025beep 2026display dialog "Color Space: " & EspaceCol & return & "File type: " & type_image & return & "Dimensions (in pixels):" & return & tab & "width = " & largeur & return & tab & "height = " & hauteur027end tellNotes: The line numbers included with this script are there to aid future discussions. In order to use this script, you will have to strip all of them.

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

How to extract Resolution and Color Mode of an image on Quar

Post by Jean-Marie Schwartz » 12 Jun 2008, 08:23

Yep! I downloaded it earlier today when the forums went ghost and not very Belgians-open :-)))
But it was back at work so I shall switch to Firefox. What a stupidity! Really!
Now back to Euro 2008 (Poland is leading 1 to 0 -> poor Austrians!). But nothing's done yet.

cits
Posts: 0
Joined: 11 Jun 2008, 08:14

How to extract Resolution and Color Mode of an image on Quar

Post by cits » 15 Jun 2008, 04:08

Thank you for your help, Jean-Marie Schwartz & Scripting_Ace!
With your script, I try adding in some ingredients to obtain the resolution of the image too.
Thanks again!

tell application "QuarkXPress Passport"
activate
delay 1
tell document 1
set this_file to (file path of image 1 of current box) as alias
try
tell application "Image Events"
launch
-- open the image file
set this_image to open this_file
try
set EspaceCol to color space of this_image as string
set type_image to file type of this_image as string
set dimensions_image to dimensions of this_image as list
set res_image to resolution of this_image as list
set largeur to (item 1 of dimensions_image as integer) as string
set hauteur to (item 2 of dimensions_image as integer) as string
set res to (item 1 of res_image as integer) as string
end try
close this_image
end tell
on error error_message
display dialog error_message
end try
end tell
beep 2
display dialog "Color Space: " & EspaceCol & return & "File type: " & type_image & return & "Dimensions (in pixels):" & return & tab & "width = " & largeur & return & tab & "height = " & hauteur & return & "Res (dpi): " & res
end tell

Post Reply

Return to “QuarkXPress 8, 9 & 10: AppleScript”