From cf2881238c293abb8c47a5450a47ec84c9e61fce Mon Sep 17 00:00:00 2001 From: hardyantz Date: Thu, 14 Sep 2017 18:53:13 +0700 Subject: [PATCH] trim whitespace for 1D barcode --- scaledbarcode.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scaledbarcode.go b/scaledbarcode.go index 152b180..bb74906 100644 --- a/scaledbarcode.go +++ b/scaledbarcode.go @@ -112,7 +112,9 @@ func scale1DCode(bc Barcode, width, height int) (Barcode, error) { if factor <= 0 { return nil, fmt.Errorf("can not scale barcode to an image smaller than %dx1", orgWidth) } - offsetX := (width - (orgWidth * factor)) / 2 + + width = (orgWidth * factor) + 2 + offsetX := 1 wrap := func(x, y int) color.Color { if x < offsetX {