WKWebView provides no way to get an image object (UIImage, CGImage, whatever) from an HTML image. You can, as you’ve already noted, pass the URL to native code and re-download it. Alternatively:
If you control the web site you could change the HTML to not use an
IMG
element but instead reference the image dynamically. At that point you can have your code (either native code or JavaScript code) download the image data and share that data with both sides.You could render the image on the web side and then pass that rendered version to your native side. I don’t know enough modern web APIs to explain the details here, but the HTML5 Canvas element seems like a good place to start.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"