Skip to content

Commit 4bf5107

Browse files
committed
feat: add new function to convert as javascript
1 parent 93b3421 commit 4bf5107

File tree

1 file changed

+9
-0
lines changed
  • photoshop/api/save_options

1 file changed

+9
-0
lines changed

photoshop/api/save_options/png.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ def dither(self):
5454
def dither(self, value):
5555
self.app.dither = value
5656

57+
def as_javascript(self) -> str:
58+
"""Is patch function to make as javascript."""
59+
return f"""
60+
var opts;
61+
opts = new ExportOptionsSaveForWeb();
62+
opts.PNG8 = {str(self.PNG8).lower()};
63+
opts.quality = {self.quality};
64+
"""
65+
5766

5867
class PNGSaveOptions(Photoshop):
5968
object_name = "PNGSaveOptions"

0 commit comments

Comments
 (0)