Mostly working, could use some fine tuning for unsupported images
This reverts commit 4a1b646e3e.
4a1b646e3e