ExportPicture supported formats ?

The documentation is more or less wrong (and unclear) on the ExportPicture supported formats.

With 19r2.1, I am able to export as tiff, pdf and psd (Photoshop)* not some others returns True but do not save the file.

The question is: what are the supported formats with ExportPicture ?
(formats that returns True and really create and save an icon into a file).

(simple) test done with El Capitan.

[code] Dim foo As Boolean

foo = ExportPicture(myPict)[/code]

  • I do not tested all file formats.

perhaps if you DID test them you’d have your answer?

I have tested ExportPicture on the mac for 2019R2 and it supports TIFF, GIF, JPEG, PNG and BMP. Tiff and Gif are recent additions as of 20019R2.

I would love to know how you can use ExportPicture to save a photoshop file!

Hi Emile,

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 )

Happy New Year,

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)

Thanks Emile,

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).

Using 2019R3 in Mojave, photoshop does not appear as an option. I guess the dialog is OS specific.

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.

Standard Image File Formats

Extended Image File Formats

El Capitan / Xojo


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.

Happy New Year!

Robert, hold the Option key whilst clicking on the “Format” popup menu.

[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.

Be careful: some options like reading PDF are available only on Mac.