Trim functionality fails with error: Unexpected error while trimming. Try to lower the tolerance
See original GitHub issueIn the latest version 0.21.3, trimming a png image fails. In a previous version 0.20.8, the code completes successfully.
Here’s my function in typescript:
async trim(dataUrl: string) {
dataUrl = dataUrl.replace(/^data:image\/png;base64,/, "");
dataUrl += dataUrl.replace('+', ' ');
let buffer = new Buffer(dataUrl, "base64");
return sharp(buffer)
.png()
.trim(1) //also tried default parameter
.toBuffer();
}
This is the output in console:
Error: Unexpected error while trimming. Try to lower the tolerance
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Cutting contour is outside of the supporting geometry. No ...
Unexpected error while reading the file. Graphics are not updated with the source file, the original shape graphics are retained. Correct the file....
Read more >Fixed Problem Reports - Siemens PLM
Internal error followed by NX crash during undo redo while checking requirement. 8365439. Styled Blend tolerance problem with activated Trimming Method Trim ......
Read more >When the Solver Fails - MATLAB & Simulink - MathWorks
The solver stopped because it reached a limit on the number of iterations or function evaluations before it minimized the objective to the...
Read more >User guide — Cutadapt 4.2 documentation - Read the Docs
All the above sequences are trimmed to mysequence when you use -g ADAPTER . ... if you search for the adapter sequence ADAPTER...
Read more >Next Step When Boolean Cut Operations Fail?
Solution ¨C either try to move the seam, or try moving one object just a tiny, tiny bit (if you can without making...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
v0.23.3 now available, thank you for the original report.
All of the pixels in this image are black and the text is contained only in the transparency layer.
By default sharp/libvips flattens to black hence the entire image is background.
We need to retrieve the background colour from the bKGD chunk in the PNG, if present, and flatten to that instead.