Thanks so much for reporting your 2015R1 tests. Unfortunately, for those of us using later versions, many of these do not work. It seems Xojo makes little attempt to keep ExportPicture consistent over the years let alone cross platform. I need to export photoshop files for my users, but have to use the following code to do so, where “buffer” contains the picture you want to save and destination is a folderitem you create to provide both the name and location of the saved photoshop file.
dim thePicture as Picture =buffer
dim data as MemoryBlock = thePicture.GetData( “com.adobe.photoshop-image” )
dim stream as BinaryStream = BinaryStream.Create( destination ,true)
stream.Write( data )
stream.Close()
I loaded my project as is with 2019r3, generate a 256 x 256 pixels image and save (ExportPicture) it choosing Photoshop (.psd) as file type: it works.
Nota: using El Capitan. I do not downloaded Catalina. I can boot later on High Sierra to check what happens there (if needed).
Used Code:
Dim foo As Boolean
foo = ExportPicture(Canvas1.Backdrop)
But I could not get it to work. Would you please copy the code you used to create a photoshop file. I do not see in your example how you are choosing photoshop.
No specific code was added, this is an Apple stuff (trick):
In the Export Dialog, there is a PopupMenu that let you choose far more file types than the 5 or so default ones when you press in the Option key while you click in it.
Same kind of trick is used in the Finder with the File Menu or Go Menu (to get the Library folder for example).
I’ve been surprised to hear that anyone expects psd to be available ‘out of the box’ … I thought it was a complex proprietary file format (includes layers data for example) , like Microsoft’s Excel and Word docs are.
Since the image created by Xojo is a ‘flat’ image, surely PNG should work in all cases - Photoshop can certainly open it.
How you are able to get the dialogue to provide the “Extended Image File Formats”. All I get are the standard image file formats you showed at the top.
[quote=469744:@Emile Schwarz]How do I do that (export to different file formats)?
Very simple, I press the alt (option) key while clicking in the file type PopupMenu.[/quote]
This discussion was timely for me as I was planning to write a program “early next year” to read and write Photoshop files.
I have just replicated this according to Emile’s instructions. I wrote a program that reads in a PSD file image (RGB, 8 bits/channel, with layers, etc) into an ImageWell, then exported back to a PSD file (or a PNG, TIFF, JPEG). This worked with 2019R3 on Mac OS Mojave. So it appears that one can read and write PSD files “out of the box” on the Mac. (I cannot test this on that “other” platform).
As Emile pointed out, the trick is to hold down the “option” key while selecting the export format. The popup options on my screen differ a bit from Emile’s, but it shows about 16 options vs about 6 without the option key.
The bad news: all the colors are “off” as it appears that XOJO does not retain the color management data embedded in the PSD file.
Agreed, the documentation (especially the example code for ExportPicture) is a mess.