Skip to content

Commit

Permalink
Remove unnecessary floodfill in CarrierWave::RMagick#resize_and_pad
Browse files Browse the repository at this point in the history
It's no longer needed after #1175. Also this behaves differently with ImageMagick 7, causing the spec to fail.
  • Loading branch information
mshibuya committed Jan 21, 2023
1 parent f5b09b8 commit f34a9bd
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/carrierwave/processing/rmagick.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,7 @@ def resize_and_pad(width, height, background=:transparent, gravity=::Magick::Cen
height = dimension_from height
manipulate! do |img|
img.resize_to_fit!(width, height)
new_img = ::Magick::Image.new(width, height) { |image| image.background_color = background == :transparent ? 'rgba(255,255,255,0)' : background.to_s }
if background == :transparent
filled = new_img.matte_floodfill(1, 1)
else
filled = new_img.color_floodfill(1, 1, ::Magick::Pixel.from_color(background))
end
destroy_image(new_img)
filled = ::Magick::Image.new(width, height) { |image| image.background_color = background == :transparent ? 'rgba(255,255,255,0)' : background.to_s }
filled.composite!(img, gravity, ::Magick::OverCompositeOp)
destroy_image(img)
filled = yield(filled) if block_given?
Expand Down

0 comments on commit f34a9bd

Please sign in to comment.