We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4bf5107 commit d01358cCopy full SHA for d01358c
examples/export_document.py
@@ -0,0 +1,22 @@
1
+# Import built-in modules
2
+import os
3
+from tempfile import mkdtemp
4
+
5
+# Import third-party modules
6
+import examples._psd_files as psd # Import from examples.
7
8
+# Import local modules
9
+from photoshop import Session
10
11
12
+PSD_FILE = psd.get_psd_files()
13
14
+if __name__ == "__main__":
15
+ psd_file = PSD_FILE["export_layers_as_png.psd"]
16
+ with Session(psd_file, action="open", auto_close=True) as ps:
17
+ opts = ps.ExportOptionsSaveForWeb()
18
19
+ png_file = os.path.join(mkdtemp(), "test.png")
20
+ active_document = ps.app.activeDocument
21
+ active_document.exportDocument(png_file, ps.ExportType.SaveForWeb, opts)
22
+ os.startfile(png_file)
0 commit comments