Image cropping of large image - Siri issue

Hi,
As part of my image recognition experiments, I’m trying to crop and resize the image before uploading to the server API in order to save time and bandwidth while on the road.
This works great while running the script directly from the app, or with 3D Touch, but when I activate the script from Siri, I get an error:

Sorry, there was a problem with the app.

I tried turning on the “Always run in app” switch, and that didn’t help as well.
The image (before cropping) is around 3 MB. Is this a limitation of the app and / or Siri?

Here is a code snippet to demonstrate the issue:

    let req = new Request("https://yehudab.com/media/2017/sample.jpg")
    let image = await req.loadImage()
    dc = new DrawContext()
    dc.opaque = true
    dc.size = new Size(1000,1000)
    //   dc.beginDrawing()
    dc.drawImageAtPoint(image, new Point(-300, -300))
    result = dc.getImage()
    //   dc.endDrawing()
    QuickLook.present(result)

I’ve tried running your script. Siri terminates because of a high memory usage. Apps aren’t granted much memory when run from a Siri shortcut. While your image may be 3 MB on disk, it can be larger when read into memory.

You’re doing the right thing when enabling “Always run in app”. This is exactly why that option is there. Unfortunately, there’s an issue in the current build where this doesn’t work properly with a Siri shortcut. It’s fixed in version 1.0.1 which is currently sent to beta testers and I expect to submit to the App Store soon.

Sorry for the inconvenience.

No problem.
I’m glad you got it fixed for the next version.

So, I’ve been testing my script with the “Always run in app” switch turned on, and I’m getting mixed results.

On the one hand, it works great in my debug setup (at home, talking to the Siri on the phone). On the other hand, in real life when I’m in the car and using CarPlay to activate the script it fails again, with a “there was a problem with the app“ message.

I assume that this is a limitation of CarPlay, that for safety reasons, it won’t allow opening third party apps, but I’m not sure.

Even if I disconnect the phone from the USB cable and try to “hey Siri” it, I get a message saying I must unlock the phone first, which beats the purpose of activating the flow hands-free. I guess that at home it happens automatically via the face detection while I’m talking to Siri.

I will try to see if I can somehow make the script run using less memory. I’ll post a reply if this helps. If you have any other ideas, please let me know.

Once again, thanks for a great app, and a great update that fixes (most of) my issues.