Photoshop engine export_as_jpeg broken?

Greetings,

I am trying to use Photoshop’s engine.export_as_jpeg() to create a jpeg of the active document to upload as an attachment for a Note.

It seems broken when trying to set the jpg quality.

#403 jpeg_options.quality = quality

Running a simple example in the Photoshop Shotgun Python Console…

jpeg_pub_path = ‘/Users/danieleaton/Desktop/PIPE_SamADev_Test_Ds_v02.jpg’
jpeg_file = engine.adobe.File(jpeg_pub_path)
jpeg_options = engine.adobe.JPEGSaveOptions
jpeg_options.quality = 12

PS_Python_Console

Should I expect this to work?

1 Like

Hmm not sure whats going on. I can reproduce the same thing here if I extract the code out into the python console like you did.

Yet calling engine.export_as_jpeg() works fine and generates a file, I assume it does for you as well?

I even copied the whole export_as_jpeg method into the python console and provided the engine to the self var and that threw the same error.

I think I’ll need to defer to an engineer, however, they are on vacation at the moment so I won’t hear back for a while.

Phil

1 Like

No. It does not work. It fails with the same error I get in the console. That what let me here.

If I comment out that line it works. I’m using CC2019. The errors looks like a RPC communication problems between Python and JS?

Daniel

1 Like

Hmm that is very odd, I can run the engine.export_as_jpeg() without error.
OK, thanks for confirming.

2 Likes

If I copy the entire export_as_jpeg() method to my script it still fails with the same error.

py Showing dialog: Add Note To Version
py Heartbeat restarted.
py _on_add_note_btn_clicked
py Traceback (most recent call last):
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/dialog.py”, line 167, in _on_add_note_btn_clicked
py note)
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/dialog.py”, line 292, in _add_note_to_version
py jpeg_export_path = self._export_as_jpeg(output_path=attachment_path)
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/dialog.py”, line 426, in _export_as_jpeg
py jpeg_options.quality = quality
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-framework-adobe/v1.0.3/python/tk_framework_adobe/rpc/proxy.py”, line 278, in setattr
py remote_names = self.data[“properties”] + self.data[“methods”].keys()
py KeyError: ‘properties’

If I copy the entire method into the Python Console I get the same errors.

jpeg_options = adobe.JPEGSaveOptions fails…
jpeg_options = adobe.JPEGSaveOptions() works…

I copied the method to my script, updated the code and it seem to be working correctly now.

DAniel

2 Likes

Hey Daniel,

Apologies for the long delay on responding here. I was away on vacation for a few weeks and I’m just getting back up to speed. Phil asked for some help on this while I was away, hence the long delay.

Looking at this a little more closely, it looks like we released a fix for this exact issue as tk-photoshopcc v1.7.2. Could you take a quick look at your project’s configuration and see if perhaps you just need to move to the latest version of the engine? The only change in that release was that one fix, so there should be minimal risk in upgrading.

Let us know if that doesn’t resolve your issue and we’ll be happy to have another look.

2 Likes