How can I resize an image in-place? #1946
Replies: 1 comment 6 replies
-
@sampletext32 unfortunately, our current Resize processor doesn't work inplace internally. It's always using separate source and destination buffers behind the scenes. When user is doing
I would better recommend Load -> Resize (Mutate) -> Copy to destination buffer for your case. I'm open for API ideas that may help eliminating the last step in future releases. I'm wondering what is your app / use case?
Note that ImageSharp does heavy pooling when managing it's buffers, and with 2.0 this will become much more efficient -- see #1730. |
Beta Was this translation helpful? Give feedback.
-
Brief explanation
I have a custom allocated byte array, which is then wrapped into Image.
When I try to resize this image, I get an exception. What I want to achieve is Image staying in it's original size, but the content is scaled.
Here is a quick resulting Image of what I want to achieve.

I am already aware of Cloning-Resizing-Drawing technique, but it's extremely memory consumptive.
Beta Was this translation helpful? Give feedback.
All reactions