Error: extract_area: bad extract area
See original GitHub issueHello, I’m using 512x512 image. First I resize it then extract and expecting readable stream data but it shows me “Error: extract_area: bad extract area” error. Here’s the code;
test2(x, y, zoom) {
const width = 500;
const height = 500;
return this.image
.metadata()
.then((metadata) => {
var resizedWidth = metadata.width * zoom;
var resizedHeight = metadata.height * zoom;
var left = parseInt(resizedWidth * x);
var top = parseInt(resizedHeight * y);
return this.image
.resize(resizedWidth, resizedHeight)
.extract({left: left, top: top, width: width, height: height})
.jpeg()
.resize(500);
});
}
Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Resize image using 'auto' in width or height not working - Bugs
Well the error we were having is gone but I now have this ... message: “extract_area: bad extract area↵”; stack: “Error: extract_area: bad...
Read more >Error: extract_area: bad extract area - Bountysource
I'm doing facial recognition, meaning I get the position and resolution where to find the face (bounding box). The original image is: 1280x720 ......
Read more >Python sitk ExtractImageFilter -- basic usage help??
Creates a small image and then extract a sub-image that is even ... itk::ERROR: ExtractImageFilter(0x7f7eb17d8e80): Extraction Region not ...
Read more >Check-in [67f13ff3ae] - SQLite
Use a wasm runtime error, because a JS error might be seen as a ... the most common failure cause to be a...
Read more >Kotlin calling non final function in constructor works
abstract class Base(var code: Int) { abstract fun calculate(): Int } class Derived(private val x: ... To: area by lazy { extractArea(room) }....
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 Free
Top 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

I know this may be an old thread - but I experienced this issue recently, and it was due to the orientation of the image on the server, not being equivalent of the interpreted orientation in the browser. Say I took a picture with my iPhone, then safari and the phone knew how to properly orient the photo, but the server no.
In order to fix that, I simply initialised the sharp procedure with
.rotate(), which took care of that.sharp('image data goes here').rotate().extract({left: left, top: top, width: width, height: height}).resize(width, height);.Just as a note for future visitors, as this issue pops up as the first result when searching in Google.
This is still an issue until this day. Is there an issue tracking this?
Edit: my bad, didn’t realize the
rotate()auto-rotates the image. Works perfectly now.