You've already forked image_processing
mirror of
https://github.com/usetrmnl/image_processing.git
synced 2026-04-29 13:33:11 -07:00
Maintain transparent background in #resize_to_fill
When using this method on a PNG image, previously it would loose transparency. This is because the "-extent" ImageMagick option sets a background color. We should explicitly set the background color to transparent, it seems to work for CarrierWave. See https://github.com/refile/refile-mini_magick/issues/11.
This commit is contained in:
@@ -110,6 +110,7 @@ module ImageProcessing
|
||||
yield cmd if block_given?
|
||||
cmd.resize "#{width}x#{height}^"
|
||||
cmd.gravity gravity
|
||||
cmd.background "rgba(255,255,255,0.0)" # transparent
|
||||
cmd.extent "#{width}x#{height}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user