Automate Photoshop

View: 782    Dowload: 0   Comment: 0   Post by: sonbka04   Category: Adobe Photoshop   Fields: Computers - Technology

Download  automate-photoshop.rar (83.11 KB)

You need to Sign In to download the file automate-photoshop.rar
If you do not have an account then Sign up for free here

Let's do it in eight easy steps:

  1. Create a Windows Application project.
  2. Add a reference to the Photoshop Object Library.

  3. To use the Photoshop object in our application, import the Photoshop namespace:
    Collapse | Copy Code
    Imports Photoshop
  4. Declare the two objects we are going to work with (the Photoshop Application object and the Photoshop Document object):
    Collapse | Copy Code
    Dim appRef As Photoshop.Application
    Dim currentDoc As Photoshop.Document
  5. Now, we should define the folder containing our pictures and the folder for the improved pictures. Add two FolderBrowseDialog controls (input and output folders can be the same, the pictures will just be overwritten; however, it is not always such a good idea). Also, add the necessary TextBoxes and Button controls.

    Add Button controls to start the process and to finish the application.

  6. Open the Photoshop application when our form is loading. Set Photoshop as invisible (we still see it when it is starting, though).
    Collapse | Copy Code
    appRef = New ApplicationClass
    appRef.Visible = False
    appRef.DisplayDialogs = PsDialogModes.psDisplayNoDialogs
    appRef.PlaybackDisplayDialogs = PsDialogModes.psDisplayNoDialogs
  7. On the application exit event, don't forget to quit Photoshop as well.
    Collapse | Copy Code
  8. Finally, the last step - process every image in the folder.
    Collapse | Copy Code
    Dim files() As String = IO.Directory.GetFiles(txtFrom.Text, "*.jpg")
    For Each fl As String In files
       currentDoc = appRef.Open(fl)
       Dim currentLayer As Photoshop.ArtLayer = _
           CType(currentDoc.ActiveLayer, Photoshop.ArtLayer)
       Dim jpeg As New Photoshop.JPEGSaveOptions
       jpeg.Quality = 8
       currentDoc.SaveAs(txtTo.Text + _
          IO.Path.GetFileName(fl), jpeg, False, 2)

Enjoy your life, and when you are back, you will find all your pictures just perfect.

Points of interest

We applied only one Auto Contrast adjustment feature. Sure there is zillion possibilities in Photoshop to improve the image we could use in our application. Just do a research of the Photoshop Document object.

Photoshop has a feature called batch processing. It could be extremely useful in our automation process. However, for some unknown reason, I could not make it work.

Automate Photoshop

You have a bunch of pictures, but they don't look that great. You'd like to increase contrast, or improve colors. Luckily, you have Adobe Photoshop CS2 with its wonderful Auto Contrast function. No problem if it's all about tens of pictures. What if there are hundreds, or even thousands? Open every picture in Photoshop, apply adjustments, save it... Oh, it is boring. Why not just automate all these tasks and let Photoshop work hard while we are lying on the beach?

Posted on 24-03-2014 


To comment you must be logged in members.

Files with category

File suggestion for you
File top downloads
Codetitle - library source code to share, download the file to the community
Copyright © 2018. All rights reserved. codetitle Develope by Vinagon .Ltd