![]() |
|
|
#1
|
|||
|
|||
|
Apply almost any action to a batch of images automatically in PSE
I would like to share a method of applying almost any action, filter, adjustment or a set of those to a large number of pictures automatically. We all know that full photoshop has a very handy action recorder that, combined with the batch processing tool, you can use to apply the same conversions to all images in a folder. I've always wanted to do something similar in Elements but the batch options are so limited that most of the time I don't find them useful for anything - there are freeware programs (eg. XnView) which can do a whole lot more than the Elements "Process Multiple Files". What I specifically wanted to do was apply a filter to all photos from my camera - for example Chromatic Aberration correction or noise reduction. Because I couldn't find any solution to this I began my own "research".
(BTW for those who wonder about CA correction there is a good free plugin at http://www.chromacute.com/ that works well with PSE 5 and later) I found a very powerful free program for automating tasks in any Windows application called AutoHotkey: http://www.autohotkey.com/. With this program you can send any number of keystrokes to any program to accomplish a series of repetitive tasks. However, this program is not very easy for everyone because you need to write a special script for your task but once you have a script ready you can use it at any time. Fortunately the help file is quite extensive and with a bit of effort you can learn to write your own scripts. Here I will show you how to do it specifically for PSE - I used PSE 7 but it should work the same in earlier versions too. First install AutoHotkey. It's not a program that you will run as a standalone application but rather invoke it by running a script. So you need to begin by writing a script for your task - you can use notepad or your favourite plain text editor. A script is a text file with the .ahk extension. When you double click on such a file in windows explorer AutoHotkey will start executing your script. I will present an example of a script that you can use right away and is quite flexible - it will apply any filter to a batch of jpg images by using the ctrl+F shortcut, which runs the last used filter. So let's begin by creating the script: Code:
#NoEnv
SetWorkingDir %A_ScriptDir%
Loop *.jpg
{
RunWait "C:\Program Files\Adobe\Photoshop Elements 7.0\PhotoshopElementsEditor.exe" "%A_LoopFileLongPath%"
Gosub WaitToComplete
SendInput ^f
Loop
{
IfWinActive Save As
{
break
}
ifWinActive ahk_class pseeditor
{
SendInput +^s
}
Sleep 500
}
Sleep 1500
SendInput {enter}
Sleep 1000
SendInput {enter}
WinWait ahk_class PSFloatC
SendInput 12{enter}
Gosub WaitToComplete
SendInput ^w
Sleep 500
}
ExitApp
WaitToComplete:
Loop
{
IfWinExist New Layer ahk_class PSFloatC
{
WinActivate New Layer ahk_class PSFloatC
break
}
ifWinActive ahk_class pseeditor
{
SendInput +^n
}
Sleep 500
}
SendInput {esc}
return
~esc::ExitApp
There are a few things to remember though: * while the script is running you should not do anything else on the computer, don't touch the keyboard and don't click with your mouse * make sure you turn off any background programs that might steal focus from PSE, for example by update alert pop-ups or low battery alerts- they may interrupt the script. The windows tray alerts are usually fine since they don't steal focus from the running application. * if you really need to stop conversion for some reason just press the Esc key, which I programmed to terminate the script. Or, right click on the H icon in the tray and choose Exit. When the H disappears you will know the script has been stopped. If you switch to other programs while the script is running you may send some unwanted keystrokes to them, which might have unexpected results (however any damage is very unlikely) Now I will explain what each of these commands do in the script so that you can easily change it and adapt it to your needs. Everything after semicolon is a comment and is not executed by a script: Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. Code:
Loop *.jpg
{
Code:
RunWait "D:\Program Files\Adobe\Photoshop Elements 7.0\PhotoshopElementsEditor.exe" "%A_LoopFileLongPath%" Code:
Gosub WaitToComplete Code:
SendInput ^f Code:
Loop
{
IfWinActive Save As; when Save As window appear we break out of the loop
{
break
}
ifWinActive ahk_class pseeditor; just for safety: we send keystrokes only if PSE is the active window
{
SendInput +^s; press shift+ctrl+S
}
Sleep 500; waits 0.5 sec. (500 milliseconds)
}
Code:
Sleep 1500; wait 1.5 sec.
SendInput {enter}; press Enter (file overwrite confirmation window opens)
Sleep 1000; wait 1 sec.
SendInput {enter}; press Enter (=we press 'Yes')
WinWait ahk_class PSFloatC; we wait until a subwindow of PSE opens, in this case it's the JPEG Options window
SendInput 12{enter}; we type 12 in as the quality number (=highest quality) and press Enter
Gosub WaitToComplete; wait for the save to complete
SendInput ^w; press ctrl+w (=close the image window)
Sleep 500; wait half a second to make sure PSE had the time to close the image and we can procees to another one
}; end of image loop section
ExitApp; exit the script when conversion is complete
Code:
WaitToComplete:
Loop
{
IfWinExist New Layer ahk_class PSFloatC
{
WinActivate New Layer ahk_class PSFloatC
break
}
ifWinActive ahk_class pseeditor
{
SendInput +^n
}
Sleep 500
}
SendInput {esc}
return
And the last one: Code:
~esc::ExitApp So now it's easy to modify this script to perform any other action we want or even a series of actions on any number of files. Just change SendInput ^f to anything else. For example, this will evoke ChromaCute filter on my computer: Code:
SendInput !t{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{right}{enter}
|
|
#2
|
|||
|
|||
|
continued...
Another example: you want to read tif files, apply some filters and save as jpeg. You need to use Loop *.tif instead of Loop *.jpg. And the Save As dialog window will now have the tif format chosen by default so we need to change it with keys (use the following code after the loop invoking the "Save As" window):
Code:
Sleep 1500; wait for Save As to appear
SendInput {tab}j{enter}; choose the JPEG format for saving
WinWait ahk_class PSFloatC; wait for JPEG Options to appear
SendInput 12{enter}; type in the quality and press Enter
And that's all that is required to run almost any action on a bunch of files in PSE. I'm happy that I have finally managed to find a method - by trial and error I have refined the script to run reliably, however I can't be sure if it will run well for everyone without modifications - I suppose it will for most people. I chose the Sleep times like these so that the script will not halt if the computer runs slower, sometimes if you were using other memory intensive applications before and switched back to PSE then things like opening the Save As window can take much slower on the first and second run. These times are always fine on my old Athlox XP 3000 machine, if your computer is slow you may need to increase the times in case the script halts. Enjoy! PS. It's a Windows only solution, but there probably is a Mac equivalent of AutoHotkey so someone might adapt this method for Macs as well. |
|
#3
|
|||
|
|||
|
Hi, Lemon-juice!
Thanks for sharing your efforts to find a way of batch processing in PSE. I must say I have not yet tested it, but it looks this can be of some help for those having some experience in programing... I have tested the ChromAcute plug-in, and it gave good results on a test file with chromatic aberration. I'll test it with other type of purple fringing. |
|
#4
|
||||
|
||||
|
Thanks, Lemon Juice, for figuring this out and taking the time to write such an in-depth tutorial. I will print this out and try it out when I get the time.
Diana
__________________
My PET Gallery My Village Gallery Happiness is not having what you want, but wanting what you have. ~ Canon Rebel XTi ~ EF70-200 f/4 ~ EF85 f/1.8 ~ EF24-70 f/2.8 ~ EF 24-105 f4 L IS ~ EF 50mm f/1.8 II ~ WinXP, Vista & Windows 7 ~ PSE 7 & 8 ~ CS3 ~ Pro Show Producer ~ Corel Painter X ~ Printers: Canon Pixma Pro9500 Mark II, HP Deskjet 882C, HP LaserJet 1200 ~ |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to burn dvd so that it repeats automatically | Gordon Macgregor | Elements for Beginners | 2 | January 21st, 2008 07:08 AM |
| PE resizing images automatically when editing. | CivicMan | Photoshop Elements 6/7/8 Questions and Answers | 16 | July 15th, 2007 08:12 PM |
| Automatically Copying? | wacom3 | General Elements Discussion | 1 | April 2nd, 2006 02:14 PM |
| I want to post photos that change automatically. | Rosiegirl | General Elements Discussion | 14 | February 20th, 2006 12:25 PM |
| Batch processing images for the web | Dean Roberts | General Elements Discussion | 1 | November 17th, 2004 01:33 AM |