How can a watchface display an image downloaded in the background by makeImageRequest?

The subject really says it all. I'm successfully downloading an image using makeImageRequest in a background process. I believe the image is stored in the graphics pool, and the background process has a reference to it as a Graphics.BitmapReference.

How then can I access this image from the main watchface view?  I can't used Background.exit() to return the BitmapReference since it isn't one of the allowed types for exit(). It should be obvious how to do this, but I can't see how.

Thanks in advance for any help.

Michael

  • Thank you for clarifying that.

  • The images need to be static indeed. I duplicate dynamic images temporarily and delete them after the Garmin watch grabbed it (this was for another app, not a watchface). That's something to be aware of when using makeImageRequest

  • But, this seems to not be an issue with Epix 2 or the "System 8 Preview Device", or CIQ 3 devices. <facepalm>This is totally great.</facepalm>

  • What's the difference between a dynamic and a static image? The body is the same. There might be some difference in the headers, but if you generate the response dynamically, then it shouldn't be a problem to provide the same headers that a "static" image would have returned. If the difference is only in the url (path, "file extension", query string), then all that can be changed with some nginx magic to look like a static file, but pass it to your php or nodejs

  • On the surface I understand why one would think that because I assumed that too. But nginx returns different headers depending on whether it serves the file itself statically, or if it comes from a php-fpm stream returning a dynamic image (getting the source image, cropping it to a round image with transparent corners). The issue is chunking, and it seems that increasing the output_buffering parameter in php.ini from the default of 4096 to a much larger number like 262144 solves the problem. So, not a Monkey C problem, but still a Garmin problem.

  • I agree it's a Garmin problem, but it seems you found a "workaround", that is good. I mean the create a static file and delete it after Garmin downloaded it is not a nice solution. Configuring the server to Garmin's liking is better.

  • Maybe I spoke too soon. So far the only CIQ 5 devices that work are AMOLED. I can't get any of the MIP devices to work even with static images. I've tried a few palette option variations in makeImageRequest and I have also tried a png I converted to indexed using the 64 colors palette. What are the dimensions of the images you are sending to the Garmin server to get them to render on the MIP devices? Is there anything else special about them?