Exporting a picture in photoshop format

When Quicktime is installed, ExportPicture is stated to support a multitude of formats (see Language Reference). When Xojo is compiled for carbon, all of these are present. But when compiled for the Cocoa framework, only a few are available: JPEG, JPEG-2000, OpenEXR, PDF, PNG and TIFF. Most of my users wish to save pictures in photoshop (.psd) format, and that format is missing. Others that are missing include: BMP, PICT, SGI, TGA, and QuickTime, but nobody wants these so no problem.

Unfortunately, many of my users require export in photoshop format. They claim that tiff files are too big, and pdf files are too compressed. Also, some want to place these files directly into illustrator, and photoshop is the best format for controlling size and color balance.

Can someone help me figure out how to export a picture in photoshop? I have the monkeybread plugins, but none provides a photoshop export option as far as I can tell. The solution needs to be cross platform as half of my users use Windows XP/7/8.

Thanks

For what it’s worth, the reason there are different options under the Cocoa framework is that we’re using ImageKit instead of the deprecated QuickTime graphics exporters.

Thanks for the explanation. But as near as I can tell, ImageKit does not have exporters, only filters. I guess I need to figure out how to get access to the deprecated QuickTime graphics exporters.

ImageKit doesn’t do the exporting – just the presentation of the save options (via IKSaveOptions in an NSSavePanel). The actual exporting is done via ImageIO (specifically CGImageDestination).

Apple’s IKImageViewDemo has code in it that’s extremely close to what we do internally. See saveImage: and savePanelDidEnd:returnCode:.

And if you’re just after the ability to save a picture as PSD and don’t need the type picker, it gets a lot easier. I can give you the necessary declares for dealing with ImageIO. It obviously won’t help you much on Windows and Linux, but I’m not familiar with those platforms.

Dear Joe,

I would really appreciate your sending me the declares (rbirge@uconn.edu) or posting them here. I already have a windows solution. It is the cocoa environment causing the problem. And I would like to use cocoa. My programs run under cocoa for the first time thanks to Xojo. Exportpicture shortcomings are the only obstacle to delivering a cocoa version right now.

Many thanks for your help.

[quote=15364:@Robert Birge]Dear Joe,

I would really appreciate your sending me the declares (rbirge@uconn.edu) or posting them here. I already have a windows solution. It is the cocoa environment causing the problem. And I would like to use cocoa. My programs run under cocoa for the first time thanks to Xojo. Exportpicture shortcomings are the only obstacle to delivering a cocoa version right now.

Many thanks for your help.[/quote]

Actually, it turns out that you can use Picture.GetData to get the picture object as PSD data on OS X. Here’s an example (with error handling omitted for clarity):

  dim destination as FolderItem = // ...
  dim thePicture as Picture = // ...
  dim data as MemoryBlock = thePicture.GetData( "com.adobe.photoshop-image" )
  dim stream as BinaryStream = BinaryStream.Create( destination )
  stream.Write( data )
  stream.Close()

Dear Joe,

This solves my problem. Thanks for your help.

Bob

Check back with me later this year, I’ve started work on the ability to export layered Photoshop documents from Xojo, currently I’ve had to pause it as I have to work on a different project.

@Sam Rowlands have some code to export PSD layered files ? :slight_smile:

I never did get this completed.