the script docs are mighty confusing and i did not find anything in regards to what i want. So i thought i’d make sure and ask if anyone here knows heh.
Is there any way to load an image directly into an existing channel? I would like to prevent the “load additional file, select all, copy/paste, close additional file” route.
So for further reference, i am going the copy paste route for now with a “place” routine being available as an alternative. What i found:
[ul]
[li]Place seemed faster with GUI visible, Copy/Pasting with the GUI turned off (why ever that is)
[/li][li]Place is using that automated transform step. I am not sure there is no filtering or whatever introduced (i don’t think so, but who knows, and i need this to be absolutely pixel perfect)
[/li][li]Place is creating Smart Objects that i then have to rasterize because i do not want Smart Objects.
[/li][/ul]
For reference here are the two functions in case anyone needs them:
def version1(source):
"""doc is a Photoshop COM object of type Document
"""
sourceFile = app.Open(source)
sourceFile.Selection.SelectAll()
sourceFile.Selection.Copy()
app.ActiveDocument = doc
doc.Paste()
sourceFile.Close()
def version2(source):
"""doc is a Photoshop COM object of type Document
"""
dialogMode = 3 # No Dialog
idPlc = app.CharIDToTypeID("Plc ")
desc3 = comtypes.client.CreateObject("Photoshop.ActionDescriptor")
idnull = app.charIDToTypeID("null")
desc3.putPath(idnull, source)
idFTcs = app.charIDToTypeID("FTcs")
idQCSt = app.charIDToTypeID("QCSt")
idQcsa = app.charIDToTypeID("Qcsa")
desc3.putEnumerated(idFTcs, idQCSt, idQcsa)
desc4 = comtypes.client.CreateObject("Photoshop.ActionDescriptor")
idHrzn = app.charIDToTypeID("Hrzn")
idPxl = app.charIDToTypeID("#Pxl")
desc4.putUnitDouble(idHrzn, idPxl, 0.000000)
idVrtc = app.charIDToTypeID("Vrtc")
idPxl = app.charIDToTypeID("#Pxl")
desc4.putUnitDouble(idVrtc, idPxl, 0.000000)
idOfst = app.charIDToTypeID("Ofst")
desc3.putObject(idOfst, idOfst, desc4)
app.ExecuteAction(idPlc, desc3, dialogMode)
doc.ActiveLayer.Rasterize(5)