Class: Mindee::V2::FileOperation::CropFiles
- Inherits:
-
Array
- Object
- Array
- Mindee::V2::FileOperation::CropFiles
- Defined in:
- lib/mindee/v2/file_operations/crop_files.rb
Overview
Collection of cropped files.
Instance Method Summary collapse
-
#save_all_to_disk(path, prefix: 'crop', file_format: nil) ⇒ Object
Save all extracted crops to disk.
Instance Method Details
#save_all_to_disk(path, prefix: 'crop', file_format: nil) ⇒ Object
Save all extracted crops to disk.
13 14 15 16 17 18 19 20 21 |
# File 'lib/mindee/v2/file_operations/crop_files.rb', line 13 def save_all_to_disk(path, prefix: 'crop', file_format: nil) FileUtils.mkdir_p(path) each.with_index(1) do |crop, idx| filename = "#{prefix}_#{format('%03d', idx)}.jpg" file_path = File.join(path.to_s, filename) crop.write_to_file(file_path, file_format) end end |