Open stefan-girlich opened 1 week ago
Please provide a complete code sample, without the 3rd party dependency, that allows someone else to reproduce. This will need to include things like a concrete definition of the imageBase64DataUri
and region
variables as well as some error handling.
Question about an existing feature
What are you trying to achieve?
I want to crop an image defined as base64 data. The original uncropped image should later be used to create a
File
object to be sent viaFormData
to a third-party service. For this purpose I create two separateBuffer
instances from the same base64 string viaBuffer.from()
.Calling
.toBuffer()
,.toArray()
, or.toFile()
on theSharp
instance used for cropping seems to affect the originalBuffer
in a way that causes an error when sent to the third-party service. The service's responds with a generic error which provides no further insights.My main question is: How is it possible that two independent buffers are linked? Is it related to buffers created via
Buffer.from()
being pooled?I am not even sure if this is a Node.js issue or a Sharp issue. Thanks for your help and for any hint or idea!
When you searched for similar issues, what did you find that might be related?
Searched this issue tracker and Google for "extract changes original buffer", "modified buffer", "Node.js buffer re-used" and all sorts of variations and combinations.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
Please provide sample image(s) that help explain this question
Any image. Black 4x4 JPEG I am currently using for testing: