Module: HighFive::ImageHelper
- Included in:
- Thor::Tasks::Android, Thor::Tasks::Ios
- Defined in:
- lib/high_five/image_helper.rb
Instance Method Summary collapse
-
#replace_image(image_path, source_path) ⇒ Object
replace the image at image_path with a resized version of the image at source_path.
Instance Method Details
#replace_image(image_path, source_path) ⇒ Object
replace the image at image_path with a resized version of the image at source_path
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/high_five/image_helper.rb', line 5 def replace_image(image_path, source_path) image = ChunkyPNG::Image.from_file(image_path) if (rmagick?) source = Magick::Image.read(source_path).first resized = source.scale(image.height, image.width) resized.write(image_path) else source = ChunkyPNG::Image.from_file(source_path) source.resize(image.height, image.width).save(image_path) end end |