Skip to content

Commit 02c3cc4

Browse files
authored
use rot command where possible (#118)
1 parent 8c85ad9 commit 02c3cc4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/image_processing/vips.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ def cover(width, height, **options)
107107

108108
# Rotates the image by an arbitrary angle.
109109
def rotate(degrees, **options)
110-
image.similarity(angle: degrees, **options)
110+
if ([0, 90, 180, 270].include?(degrees) && options.empty?)
111+
rot_command = "rot#{degrees}".to_sym
112+
image.public_send rot_command
113+
else
114+
image.similarity(angle: degrees, **options)
115+
end
111116
end
112117

113118
# Overlays the specified image over the current one. Supports specifying

0 commit comments

Comments
 (0)