OSX Scripting Options for Photoshop

I am trying to save an image from Adobe Photoshop as PNG

I achieved this with the following code.

AdobePhotoshopApplication* psApp = [SBApplication applicationWithBundleIdentifier:@"com.adobe.Photoshop"];
AdobePhotoshopDocument *curDoc   = [psApp currentDocument];
AdobePhotoshopDocument *temp     = [curDoc saveIn:[NSURL URLWithString:[path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] as:AdobePhotoshopSvFmPNG copying:YES appending:AdobePhotoshopE300LowercaseExtension withOptions:nil];

      

Well, the only problem here is that even a simple image takes 4-5 MB. Now I want to provide AdobePhotoshopSaveOptions

insaveIn:as:copying:appending:withOptions:

I can provide the compression value in parameters as seen in

// Settings related to saving a PNG document
@interface AdobePhotoshopPNGSaveOptions : AdobePhotoshopSaveOptions    
@property NSInteger compression;  // compression used on the image. ( 0 - 9; default: 0 )
@property BOOL interlaced;  // should rows be interlaced? ( default: false )    
@end

      

The problem is, when I create parameters and pass them to the method saveIn

, I get the following error:

*** NSForwarding: warning: object 0x618000030280 of class '__NSMessageBuilder' does not implement doesNotRecognizeSelector: -- abort

      

I created AdobePhotoshopPNGSaveOptions

as

AdobePhotoshopPNGSaveOptions *options = [[psApp classForScriptingClass:@"PNG save options"] new];

      

I don't know where to go from here.

+3


source to share





All Articles