How to use outputImage in makeImageSnapshot? #3190
Replies: 5 comments 6 replies
-
you can create an empty (nullptr) image using Skia.Image.MakeNull() and use that as the value for image. let me know if this helps. |
Beta Was this translation helpful? Give feedback.
-
you can see an example on how we use it at
https://github.com/Shopify/react-native-skia/pull/3176/files
…On Wed, Jun 18, 2025 at 3:02 PM Corelli-18512 ***@***.***> wrote:
This crashes the app immediately because of a null error. Seems like cannot
handle the nullptr value well?
—
Reply to this email directly, view it on GitHub
<#3190 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACKXVUZ6KYMO2IQURC2LPD3EFPNDAVCNFSM6AAAAAB7S7K4KSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNJQHEYTMMQ>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
@wcandillon Can you pls take a look at this? I am kind of blocked by memory issues here when I tried to update a large image onto canvas frequently. |
Beta Was this translation helpful? Give feedback.
-
@wcandillon I made an example here, which simply generate a random color block on the canvas per click.
This will not update the image on the canvas from the second click:
Basically I want a way to avoid disposing the image and update the canvas directly. Some advice will be appreciated! |
Beta Was this translation helpful? Give feedback.
-
Ok after some attempts I find a way to reduce the refresh of the whole canvas, which can resolve the memory issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have been struggling with similar issues as #2581. Basically the memory release is not immediate after an image instance is disposed, which sometimes makes my app reach 2GB ceiling of IOS memory allocation. However, I accidentally noticed the signature change in makeImageSnapshot introduced here. Seems like we can pass in the image object and make snapshot directly onto its ref. I believe this can perfectly solve the GC related problem because there is no need to create new Images again and again and wait for disposing. However this cannot trigger image refresh on a canvas. More specifically I change my code from:
to:
with some template like:
I found no documentation to use this parameter (the signature of makeImageSnapshot is not updated neither) -- what is the correct way to utilize this?
Beta Was this translation helpful? Give feedback.
All reactions