make png and jpeg configurable in config

This commit is contained in:
Milan Kolar 2020-07-30 17:45:05 +02:00
parent edf61b7c28
commit 8934fba388

View file

@ -13,6 +13,7 @@ class ExtractImage(pype.api.Extractor):
label = "Extract Image"
hosts = ["photoshop"]
families = ["image"]
formats = ["png", "jpg"]
def process(self, instance):
@ -32,10 +33,12 @@ class ExtractImage(pype.api.Extractor):
if layer.id not in extract_ids:
layer.Visible = False
save_options = {
"png": photoshop.com_objects.PNGSaveOptions(),
"jpg": photoshop.com_objects.JPEGSaveOptions()
}
save_options = {}
if "png" in self.formats:
save_options["png"] = photoshop.com_objects.PNGSaveOptions()
if "jpg" in self.formats:
save_options["jpg"] = photoshop.com_objects.JPEGSaveOptions()
file_basename = os.path.splitext(
photoshop.app().ActiveDocument.Name
)[0]