A new update to Focos lets you turn any photo into a “portrait mode”-style image with fully adjustable depth of field, no matter what kind of camera you took it with. It’s not quite magic, but it is pretty cool.

Focos has long been one of the most ambitious photo-editing apps on iOS, giving you control over the depth map generated by dual-camera iPhones in portrait mode. You can adjust aperture, simulate different styles of bokeh from various lenses, choose different points of focus, and so on.

For example, here’s a picture of our bunny shot in portrait mode on an iPhone 8 Plus:

And here it is in Focos, where you’re able to view the depth map from another angle and actually add a virtual bulb in 3D space to provide directional lighting:

Here it is flipped around to a side-on view where you can adjust the precise depth of field:

You can even use AR to move your perspective inside the depth map in real time.

All of this previously relied on access to depth information that Apple has made available to developers since iOS 11, meaning Focos only worked with photos that were taken on dual-camera iPhones: the iPhone 7 Plus, 8 Plus, X, or XS. Now, though, Focos 2.0 has just been released and works with single-lens cameras as well.

Focos 2.0 uses machine learning to calculate depth maps for any picture. Developer Patrick Wang tells The Verge that his AI engine is based on Apple’s CoreML framework and has been trained on a million images. It can run on any iOS device with a 64-bit processor, meaning the A7 (iPhone 5S) and up.

In my testing, the results are pretty impressive. The AI engine still gets tripped up on the kind of things that often trip up actual dual-camera systems — fine patterns, overlapping objects, hair, and so on — but overall it does a good job for regular snapshots.

Like this one, for example:

Focos is able to calculate a depth map that looks like this:

And that gives you the ability to tap anywhere in the photo to select your focal point, like this:

The flaws aren’t hard to see if you look closely, of course. No-one could or should be using this for critical photographic work. But it’s a lot of fun to play with, and a great example of what can be done with computational photography. It also gives dual-camera iPhone users an option for portrait mode with the regular lens. The single-camera iPhone XR does that already when it detects people in the frame, but dual-camera iPhones can only use portrait mode with the telephoto camera, which gives a zoomed-in perspective and is much less effective in low light.

Focos is mostly free, with subscription options that unlock extra lens effects and full-resolution image exports. The app is constantly pushing what’s possible on iOS — it let you adjust aperture almost a year before Apple delivered a native version of the feature on the iPhone XS, for example. It’s worth keeping around just to check in on the current limits of iOS camera technology.

As for what’s next, Wang says he’s working on a version of Focos for video that’s due to ship this year.