Skip to content

Commit

Permalink
use rot command where possible (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
etherbob authored Jun 6, 2024
1 parent 8c85ad9 commit 02c3cc4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/image_processing/vips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ def cover(width, height, **options)

# 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
Expand Down

0 comments on commit 02c3cc4

Please sign in to comment.