Skip to main content
Participant
April 18, 2011
Answered

Scripting Lens Correction to process millions of photos

  • April 18, 2011
  • 1 reply
  • 4935 views

We have several million "Fish-Eye" images that we need to flatten out and the new "Lens Correction" feature of Photoshop CS5 appears to work pretty well.  I was able to use the predefined File -> Automate -> Lens Correction function to process a hanfull of images and it worked fine for a small batch.

I would like to know if there is a way with Photoshop CS5 to script/batch out a process so that I can use it to process the millions of individual files we need to have processed.

Also, I am not familiar with the Photoshop "Batch" or "Scripting" process, so assuming the above request is possible, some direction on how to proceed would be greatly appreciated.

Thank You.
Lee

This topic has been closed for replies.
Correct answer JJMack

Open a fisheye lens image in Photoshop

Open the Actions Palette click on add new Action Set Icon in the botton of the Actions Palette looks like a folder name it ImageProcessor Actions

Click on add New Action Icon in bottom of the Actions Palette name it lens correction click record.

Use Photoshop menu Filter>Lens Correction... In the Lens Correction dialog make all the setting required for your Fisheye lens and click OK

Click on the Stop recording button in the Actions Palette

Hightlight the Action set you just recorded the action into in the Actions Palette

Use the Actions Palette fly-out menu in the upper right corner of the Actions Palette item Save Actions and save your action.

Scripts and actions run inside Photoshop not outside.... Also Lens Correction in Photoshop is done by a Photoshop Filter Plug-in that runs from within Photoshop. I quite sure you used this indirectly when you used menu File>Automate>Lens Correction... which runs a an Automate script "Lens Correct.jsx" the lens correction plug-in is also used indirectly within a PhotoMerge stack from the stack script "LensCorrect.exv".

If your images are within a single file system tree you can point the Image Processor script at the root and check include all subfolders also point the Image Processor at your action and where you want the new files saved then click Run. Then go on vacation perhaps when you return from vacation all the images files will have been processed. Using Links within the file system tree you may even be able to process more then a single tree. If your images are from more then one Fisheye lens types and focal length.  You may have to script the Lens Correction Plugin like done in the Automate Lens Correction script. "Lens Correct.jsx" there is a large comment in it that may help you understand how to do that.

1 reply

JJMack
Community Expert
Community Expert
April 18, 2011

"Millions of individual fisheye files" I find that hard to beleive think your full of it your not "Starkiss" quality Charley. For fewer then millions you might try creating an action to applies the lens correction filter and use it with the Image Processor Script that ships with Photoshop. Fear that if indeed you do have several millions of fisheye files that you would run out of disk space for the Image processor creates new files and leaves your fisheye files on disk. Several Millions of mega bytes files start to add up to real space. You'll need a big stripped raid setup use TERROR Byte drives and expect it to take a terrifyingly long time.

Several,000,000 times Several,000,000 = Several Squared,000,000,000,000 Bytes.

JJMack
LeeVDuhlAuthor
Participant
April 19, 2011

Unfortunatly I'm talking millions of images.  Anwhere from 3 to 20 millon. Space is not an issue but time may be but that will all be evaluated during this process.

From what I've figured out so far, handling this via a script would probalby be the best way to handle it as I may have to do some other integration in order to retrieve my lists of files to process, handle errors and dynamically name the saved images.  I also believe scripting will allow me to run the process from outside of Photoshop.

For now, however, I'm trying the simpler approach mentioned above.  So how would I go about creating an action to applie lens correction?

Thanks

Lee

JJMack
Community Expert
JJMackCommunity ExpertCorrect answer
Community Expert
April 19, 2011

Open a fisheye lens image in Photoshop

Open the Actions Palette click on add new Action Set Icon in the botton of the Actions Palette looks like a folder name it ImageProcessor Actions

Click on add New Action Icon in bottom of the Actions Palette name it lens correction click record.

Use Photoshop menu Filter>Lens Correction... In the Lens Correction dialog make all the setting required for your Fisheye lens and click OK

Click on the Stop recording button in the Actions Palette

Hightlight the Action set you just recorded the action into in the Actions Palette

Use the Actions Palette fly-out menu in the upper right corner of the Actions Palette item Save Actions and save your action.

Scripts and actions run inside Photoshop not outside.... Also Lens Correction in Photoshop is done by a Photoshop Filter Plug-in that runs from within Photoshop. I quite sure you used this indirectly when you used menu File>Automate>Lens Correction... which runs a an Automate script "Lens Correct.jsx" the lens correction plug-in is also used indirectly within a PhotoMerge stack from the stack script "LensCorrect.exv".

If your images are within a single file system tree you can point the Image Processor script at the root and check include all subfolders also point the Image Processor at your action and where you want the new files saved then click Run. Then go on vacation perhaps when you return from vacation all the images files will have been processed. Using Links within the file system tree you may even be able to process more then a single tree. If your images are from more then one Fisheye lens types and focal length.  You may have to script the Lens Correction Plugin like done in the Automate Lens Correction script. "Lens Correct.jsx" there is a large comment in it that may help you understand how to do that.

JJMack