Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Downscale image further for platerecognizer ALPR if needed
A user found an image that, despite already being less than 4096 pixels wide, remained larger than the maximum filesize accepted by platerecognizer, even after being downscaled. This change makes it so that we scale it further down to 2048 pixels wide if it's still too big after being scaled to 4096. See here for more context: https://reportedcab.slack.com/archives/C7Z0BHMMY/p1734719601962699?thread_ts=1733722096.369269&cid=C7Z0BHMMY: > just tried that one locally, and it looks like the image is too big > for the ALPR API, even after the webapp downscales it. Guess I need to > tweak that to squeeze it down further, yet again... > > image buffer length BEFORE sharp: 4855730 bytes > image buffer length AFTER sharp: 2589893 bytes > orientImageBuffer: 187.262ms > file size is greater than maximum of 2411654 bytes, attempting to scale down to width of 4096 > file size after scaling down: 2426287 bytes > STARTING platerecognizer > /platerecognizer plate-reader got an error with first token, trying second > /platerecognizer plate-reader { > platerecognizerRes: Response { > size: 0, > timeout: 0, > [Symbol(Body internals)]: { body: [PassThrough], disturbed: false, error: null }, > [Symbol(Response internals)]: { > url: 'https://api.platerecognizer.com/v1/plate-reader/', > status: 413, > statusText: 'Request Entity Too Large', > headers: [Headers], > counter: 0 > } > } > }
- Loading branch information