From 06b61af2a893fe9798bdb085cdef0fe797aa2b40 Mon Sep 17 00:00:00 2001 From: DarthSim Date: Mon, 28 Sep 2020 16:04:24 +0600 Subject: [PATCH] Fix dpr+extend --- process.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/process.go b/process.go index 844fca61..9f81bda1 100644 --- a/process.go +++ b/process.go @@ -474,9 +474,9 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces return err } - if po.Extend.Enabled && (po.Width > img.Width() || po.Height > img.Height()) { - offX, offY := calcPosition(po.Width, po.Height, img.Width(), img.Height(), &po.Extend.Gravity, false) - if err = img.Embed(po.Width, po.Height, offX, offY, po.Background, transparentBg); err != nil { + if po.Extend.Enabled && (dprWidth > img.Width() || dprHeight > img.Height()) { + offX, offY := calcPosition(dprWidth, dprHeight, img.Width(), img.Height(), &po.Extend.Gravity, false) + if err = img.Embed(dprWidth, dprHeight, offX, offY, po.Background, transparentBg); err != nil { return err } }