mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure correct dimensions when contain 1px image #2951
This commit is contained in:
@@ -382,11 +382,15 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
// Ensure shortest edge is at least 1 pixel
|
||||
if (image.width() / xfactor < 0.5) {
|
||||
xfactor = 2 * image.width();
|
||||
baton->width = 1;
|
||||
if (baton->canvas != Canvas::EMBED) {
|
||||
baton->width = 1;
|
||||
}
|
||||
}
|
||||
if (image.height() / yfactor < 0.5) {
|
||||
yfactor = 2 * image.height();
|
||||
baton->height = 1;
|
||||
if (baton->canvas != Canvas::EMBED) {
|
||||
baton->height = 1;
|
||||
}
|
||||
}
|
||||
image = image.resize(1.0 / xfactor, VImage::option()
|
||||
->set("vscale", 1.0 / yfactor)
|
||||
|
||||
Reference in New Issue
Block a user