mirror of
https://github.com/usetrmnl/image_processing.git
synced 2026-08-13 14:27:14 -07:00
use rot command where possible (#118)
This commit is contained in:
@@ -107,7 +107,12 @@ module ImageProcessing
|
||||
|
||||
# Rotates the image by an arbitrary angle.
|
||||
def rotate(degrees, **options)
|
||||
image.similarity(angle: degrees, **options)
|
||||
if ([0, 90, 180, 270].include?(degrees) && options.empty?)
|
||||
rot_command = "rot#{degrees}".to_sym
|
||||
image.public_send rot_command
|
||||
else
|
||||
image.similarity(angle: degrees, **options)
|
||||
end
|
||||
end
|
||||
|
||||
# Overlays the specified image over the current one. Supports specifying
|
||||
|
||||
Reference in New Issue
Block a user