diff --git a/transform.go b/transform.go index cfa00bf..92e0d82 100644 --- a/transform.go +++ b/transform.go @@ -207,14 +207,6 @@ func transformImage(m image.Image, opt Options) image.Image { } } - // flip - if opt.FlipVertical { - m = imaging.FlipV(m) - } - if opt.FlipHorizontal { - m = imaging.FlipH(m) - } - // rotate switch opt.Rotate { case 90: @@ -225,5 +217,13 @@ func transformImage(m image.Image, opt Options) image.Image { m = imaging.Rotate270(m) } + // flip + if opt.FlipVertical { + m = imaging.FlipV(m) + } + if opt.FlipHorizontal { + m = imaging.FlipH(m) + } + return m } diff --git a/transform_test.go b/transform_test.go index 7fc0e5c..2897bbc 100644 --- a/transform_test.go +++ b/transform_test.go @@ -185,6 +185,11 @@ func TestTransformImage(t *testing.T) { Options{FlipHorizontal: true, FlipVertical: true}, newImage(2, 2, yellow, blue, green, red), }, + { + ref, + Options{Rotate: 90, FlipHorizontal: true}, + newImage(2, 2, yellow, green, blue, red), + }, // resizing { // can't resize larger than original image @@ -247,7 +252,7 @@ func TestTransformImage(t *testing.T) { { newImage(4, 2, red, red, blue, blue, red, red, blue, blue), Options{Width: 2, Height: 1, Fit: true, FlipHorizontal: true, Rotate: 90}, - newImage(1, 2, red, blue), + newImage(1, 2, blue, red), }, // crop