From 812532b6150eb0b31446bed66fb177794fd781bb Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Mon, 6 Apr 2015 17:26:04 +0200 Subject: [PATCH] fix(resize): support rotate --- resize.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/resize.go b/resize.go index 0a192f9..703eab0 100644 --- a/resize.go +++ b/resize.go @@ -34,6 +34,8 @@ func Resize(buf []byte, o Options) ([]byte, error) { return nil, errors.New("Unsupported image output type") } + debug("Options: %#v", o) + // get WxH inWidth := int(image.Xsize) inHeight := int(image.Ysize) @@ -100,12 +102,14 @@ func Resize(buf []byte, o Options) ([]byte, error) { return nil, err } - rotation, flip := calculateRotationAndFlip(image, o.Rotate) - if flip { - o.Flip = HORIZONTAL - } - if rotation != D0 { - o.Rotate = rotation + if o.Rotate == 0 { + rotation, flip := calculateRotationAndFlip(image, o.Rotate) + if flip { + o.Flip = HORIZONTAL + } + if rotation > D0 { + o.Rotate = rotation + } } if o.Rotate > 0 {