Module: ImageProcessing::Vips::Processor::Utils
- Defined in:
- lib/image_processing/vips.rb
Class Method Summary collapse
-
.select_valid_loader_options(source_path, options) ⇒ Object
libvips uses various loaders depending on the input format.
-
.select_valid_options(operation_name, options) ⇒ Object
libvips uses various loaders and savers depending on the input and output image format.
-
.select_valid_saver_options(destination_path, options) ⇒ Object
Filters out unknown options for saving images.
Class Method Details
.select_valid_loader_options(source_path, options) ⇒ Object
libvips uses various loaders depending on the input format.
202 203 204 205 |
# File 'lib/image_processing/vips.rb', line 202 def (source_path, ) loader = ::Vips.vips_foreign_find_load(source_path) loader ? (loader, ) : end |
.select_valid_options(operation_name, options) ⇒ Object
libvips uses various loaders and savers depending on the input and output image format. Each of these loaders and savers accept slightly different options, so to allow the user to be able to specify options for a specific loader/saver and have it ignored for other loaders/savers, we do some introspection and filter out options that don’t exist for a particular loader or saver.
219 220 221 222 223 224 |
# File 'lib/image_processing/vips.rb', line 219 def (operation_name, ) introspect = ::Vips::Introspect.get(operation_name) = introspect.optional_input.keys.map(&:to_sym) .select { |name, value| .include?(name) } end |
.select_valid_saver_options(destination_path, options) ⇒ Object
Filters out unknown options for saving images.
208 209 210 211 |
# File 'lib/image_processing/vips.rb', line 208 def (destination_path, ) saver = ::Vips.vips_foreign_find_save(destination_path) saver ? (saver, ) : end |