Use Image Playground in Xojo

Since macOS 15.2 we can use Image Playground in our applications. The users love to generate an image with Apple Intelligence. Whether you need a cool image to add to a social post, a placeholder image for some operation, the AI can just generate something based on a few keywords.

Our ImagePlaygroundMBS class provides a few methods to handle this. You make an instance, configure it with maybe a few concept phrases, a source image and then show it. We recommend to show it from a button somewhere in the user interface. You implement the events and the CreatedImage event will provide the folderitem to the image file. Just load and display like our example project.

Here is a sample code to show the panel with two concept texts added:

	 Var controller As New ImagePlaygroundMBS
	controller.AddConcept "Cat"
	controller.AddConcept "New Year"
	controller.Present

You may need to subclass the ImagePlaygroundMBS class to add the CreatedImage event or use AddHandler to connect it to a method in your window and receive the new image. The pictures arrive as HEIC files with 1024x1024 pixel in size as far as we see.

Sub CreatedImage(file as FolderItem)
	MainWindow.ShowPicture Picture.Open(file)
End Sub

Please try with 24.6pr4 plugin and check the example project. Maybe before, check system preferences to enable Apple Intelligence if possible.

5 Likes

the app store told me this Image Playground app from apple is not available in germany for iPad :frowning:
surprising that this service in mbs works.

You need to turn your Mac to English and change region to USA.
Then you can try to enable Apple Intelligence in the System Preferences.

Works fine here on my Test Macbook.

1 Like

That’s a caveat that would have been nice to read in the original post :wink:.
Being excited to try then realising the need to change the mac’s region just to try.

You can enjoy it in April, when this stuff comes to Europe officially.

Or just make a new user account on your Mac or get a separate test Mac.

It’ll be in English only, IIRC.

Of course, there are solutions. I was just disappointed that reading the original post didn’t remind me it wouldn’t be straightforward. Not a great deal, anyway.