Class: RemoveBg::CompositeResult
- Defined in:
- lib/remove_bg/composite_result.rb
Overview
Handles image composition for larger images (over 10MP) where transparency is required.
Instance Attribute Summary
Attributes inherited from Result
Instance Method Summary collapse
-
#save_zip(file_path, overwrite: false) ⇒ nil
Saves the ZIP archive containing the alpha.png and color.jpg files (useful if you want to handle composition yourself).
-
#save_zip!(file_path) ⇒ nil
Saves the ZIP archive containing the alpha.png and color.jpg files, overwriting any exisiting files (useful if you want to handle composition yourself).
Methods inherited from Result
#data, #initialize, #save, #save!
Constructor Details
This class inherits a constructor from RemoveBg::Result
Instance Method Details
#save_zip(file_path, overwrite: false) ⇒ nil
Saves the ZIP archive containing the alpha.png and color.jpg files (useful if you want to handle composition yourself)
17 18 19 20 21 22 23 |
# File 'lib/remove_bg/composite_result.rb', line 17 def save_zip(file_path, overwrite: false) raise FileOverwriteError.new(file_path) if File.exist?(file_path) && !overwrite warn("DEPRECATION WARNING: overwrite: true is deprecated and will be removed from remove_bg 2.0 (use save_zip! instead)") if overwrite FileUtils.cp(download, file_path) end |
#save_zip!(file_path) ⇒ nil
Saves the ZIP archive containing the alpha.png and color.jpg files, overwriting any exisiting files (useful if you want to handle composition yourself)
30 31 32 |
# File 'lib/remove_bg/composite_result.rb', line 30 def save_zip!(file_path) FileUtils.cp(download, file_path) end |