File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,14 @@ func rotateImg(filePath string, orientation int) error {
134
134
img = rotate90 (rotate90 (img ))
135
135
case 6 :
136
136
img = rotate90 (rotate90 (rotate90 (img )))
137
+ case 2 :
138
+ img = mirrorImg (img )
139
+ case 7 :
140
+ img = rotate90 (mirrorImg (img ))
141
+ case 4 :
142
+ img = rotate90 (rotate90 (mirrorImg (img )))
143
+ case 5 :
144
+ img = rotate90 (rotate90 (rotate90 (mirrorImg (img ))))
137
145
}
138
146
139
147
if err = resultImg .Truncate (0 ); err != nil {
@@ -252,6 +260,18 @@ func rotate90(img image.Image) image.Image {
252
260
return newImg
253
261
}
254
262
263
+ func mirrorImg (img image.Image ) image.Image {
264
+ bounds := img .Bounds ()
265
+ width , height := bounds .Dx (), bounds .Dy ()
266
+ newImg := image .NewRGBA (image .Rect (0 , 0 , width , height ))
267
+ for x := 0 ; x < width ; x ++ {
268
+ for y := 0 ; y < height ; y ++ {
269
+ newImg .Set (width - x - 1 , y , img .At (x , y ))
270
+ }
271
+ }
272
+ return newImg
273
+ }
274
+
255
275
func (f * LibRawGenerator ) Priority () int {
256
276
return 250
257
277
}
You can’t perform that action at this time.
0 commit comments