JustinEzequiel
Programmer
Can anybody point me to articles re automating PhotoShop 5.5? Sample code would be welcome.
I need to convert images to EPS, JPEG, CCITT4, etc.
Below is the best that I could do.
As you can see, I had to assume that the images have the correct extension as I could only use 'Open' and not
'Open As'.
I recorded two actions in Photoshop as I could not find a
'Save As' method.
In addition, I could not find a way to get the image information (dimensions, bits/pixel, DPI, etc.)
Can Illustrator be automated similarly?
Public Function PhotoDocCreated(ByVal sSource As String, _
ByVal nActionIndex As Integer) As Boolean
' assume sSource is with correct extension (.tif for TIFF, .jpg for JPEG, etc.)
' will create EPS or JPG file with extension .eps or .jpg in same folder as sSource
' nActionIndex = 1 ' SaveAsEps
' nActionIndex = 2 ' SaveAsJpg
Dim oPhoto As PhotoshopTypeLibrary.PhotoshopApplication
Dim oPhotoDoc As IAutoPSDoc
On Error GoTo ERRORHANDLER
PhotoDocCreated = False
Set oPhoto = New PhotoshopTypeLibrary.PhotoshopApplication
Set oPhotoDoc = oPhot
pen(sSource)
oPhoto.Actions(nActionIndex).Play
oPhotoDoc.Close
Set oPhotoDoc = Nothing
oPhoto.Quit
Set oPhoto = Nothing
PhotoDocCreated = True
Exit Function
ERRORHANDLER:
msProblem = Err.Description
PhotoDocCreated = False
End Function
I need to convert images to EPS, JPEG, CCITT4, etc.
Below is the best that I could do.
As you can see, I had to assume that the images have the correct extension as I could only use 'Open' and not
'Open As'.
I recorded two actions in Photoshop as I could not find a
'Save As' method.
In addition, I could not find a way to get the image information (dimensions, bits/pixel, DPI, etc.)
Can Illustrator be automated similarly?
Public Function PhotoDocCreated(ByVal sSource As String, _
ByVal nActionIndex As Integer) As Boolean
' assume sSource is with correct extension (.tif for TIFF, .jpg for JPEG, etc.)
' will create EPS or JPG file with extension .eps or .jpg in same folder as sSource
' nActionIndex = 1 ' SaveAsEps
' nActionIndex = 2 ' SaveAsJpg
Dim oPhoto As PhotoshopTypeLibrary.PhotoshopApplication
Dim oPhotoDoc As IAutoPSDoc
On Error GoTo ERRORHANDLER
PhotoDocCreated = False
Set oPhoto = New PhotoshopTypeLibrary.PhotoshopApplication
Set oPhotoDoc = oPhot
oPhoto.Actions(nActionIndex).Play
oPhotoDoc.Close
Set oPhotoDoc = Nothing
oPhoto.Quit
Set oPhoto = Nothing
PhotoDocCreated = True
Exit Function
ERRORHANDLER:
msProblem = Err.Description
PhotoDocCreated = False
End Function