Batch Processing Script for GraphicConverter

Hello,

I have just discovered this site and I am hoping someone could help me.
I am completely new to the concept of “scripting” and I do not even know where to start…

I would like to know if there is any way I can process a bunch of graphic files using GraphicConverter (V6.2).
I have looked into the batch processing functions in GraphicConverter but I could not find what I wanted to accomplish.

I have a whole bunch of graphics files that are actually text blocks saved as TIFF files.
The text face is black and the outline is red. I would like to use GraphicConverter V6.2 to “swap colors” so that the text face will be red and the outline is black. “Swap colors” feature can be found in Picture>Colors>Swap Colors. I would like to do this to all the files in a folder (about 200 files all together) quickly.

I would appreciate any help.
Thank you in advance for your time.

Model: MacBook Pro
AppleScript: 2.2.1
Browser: Firefox 3.0.4
Operating System: Mac OS X (10.5)

Hi yurikacap,

Welcome to the world of MacScripter!

I have looked into the AppleScript dictionary of GraphicConverter and wrote the following droplet for you. You will need to change the RGB color values according to your requirements*. The script does currently not verify if the dropped files are images. Moreover it overwrites the original image file! Therefor test it on sample files first!

You will need to copy and paste the code below into a new Script Editor document, then save it as an Application bundle to create a droplet.

  • If you do not know the RGB color values, then you can find out about them as follows: Create a new document in Script Editor and type choose color. Then run the script and select a color in your image file. The RGB color value result will be shown in the Result tab in the Script Editor window.

on open finderitems
	try
		repeat with finderitem in finderitems
			tell application "GraphicConverter"
				open (finderitem as alias) without messages
				tell window 1 to swap colors color {6678, 13524, 27430} with {63994, 63994, 63994}
				save window 1
				close window 1
			end tell
		end repeat
	on error errmsg number errnum
		tell me
			activate
			display dialog "Sorry, an error occured:" & return & return & errmsg & return & "(" & errnum & ")" buttons {"OK"} default button 1 with icon stop giving up after 30
		end tell
	end try
end open

Thank you very much for your help.

I copied and pasted your script.
I changed the color values in the 6th line as follows as I want Red (255, 255,0) and Black (0, 0, 0) to swap.
tell window 1 to swap colors color {255, 255, 0} with {0, 0, 0}

I kept everything else as is.
However, when I tried it, I got the following message.
“Sorry an error occurred.
Can’t get window 1. (-1728)”

What can I do?

Thank you for your help.

Any additional code is necessary because “Swap colors” is not available from the initial pulldown menu?
When GraphicConverter first opens the file, you need to go to “Picture” in the menu first an then Colors>Swap Colors.
When you choose Swap Colors, a window opens up and asks for the two colors to swap.

I really appreciate your help with this.

Best,

I must have been doing something wrong before, now I don’t get an error message, but it is not “swapping colors.”
By the way, I had the RGB values wrong before. Red is {255,0,0} instead of {255,255,0}.

This is what it looks like. When I drop a few files, it runs but the colors are not changing.


on open finderitems
	try
		repeat with finderitem in finderitems
			tell application "GraphicConverter"
				open (finderitem as alias) without messages
				tell window 1 to swap colors color {0, 0, 0} with {255, 0, 0}
				save window 1
				close window 1
			end tell
		end repeat
	on error errmsg number errnum
		tell me
			activate
			display dialog "Sorry, an error occured:" & return & return & errmsg & return & "(" & errnum & ")" buttons {"OK"} default button 1 with icon stop giving up after 30
		end tell
	end try
end open

I apologize for my lack of knowledge.
This is my first time to even see what a script looks like.
I have reviewed Martin’s post over and over and finally it is working!

This is the final script that works.



on open finderitems
	try
		repeat with finderitem in finderitems
			tell application "GraphicConverter"
				open (finderitem as alias) without messages
				tell window 1 to swap colors color {0, 0, 0} with {65535, 0, 0}
				save window 1
				close window 1
			end tell
		end repeat
	on error errmsg number errnum
		tell me
			activate
			display dialog "Sorry, an error occured:" & return & return & errmsg & return & "(" & errnum & ")" buttons {"OK"} default button 1 with icon stop giving up after 30
		end tell
	end try
end open

THANK YOU SO MUCH FOR YOUR HELP!!!:slight_smile: