Module: Cooltrainer::DistorteD::Technology::Vips::Save
- Included in:
- Molecule::Font, Molecule::SVG, Molecule::Text, Cooltrainer::DistorteD::Technology::Vips
- Defined in:
- lib/distorted-floor/modular_technology/vips/save.rb
Constant Summary collapse
- OUTER_LIMITS =
Vips allows us to query supported SAVE types based on String file suffixes defined in Saver C code. irb(main)> Vips.get_suffixes
> [“.csv”, “.mat”, “.v”, “.vips”, “.ppm”, “.pgm”, “.pbm”, “.pfm”,
".hdr", ".dz", ".png", ".jpg", ".jpeg", ".jpe", ".webp", ".tif", ".tiff", ".fits", ".fit", ".fts", ".gif", ".bmp"]
Vips chooses Loader modules, on the other hand, by sniffing the first few bytes of the file, so a list of file extensions for supported loadable formats won't always be complete. For example, SVG and PDF are usually supported as loaders (via rsvg and PDFium/Poppler) but are nowhere to be found in the Saver-based `:get_suffixes`: github.com/libvips/ruby-vips/issues/186
Cooltrainer::DistorteD::Technology::Vips::VipsType::saver_types.keep_if { |type, _operations| # Skip textual formats like CVSV image data, and skip mistakenly-detected font Types. # # Suffix-based Loader detection with the `mime-types` library/database we use # causes us to detect a Netpbm PortableFloatmap as an Adobe Printer Font Metrics file: # https://en.wikipedia.org/wiki/Netpbm#32-bit_extensions !type.to_s.include?(-'text') and !type.to_s.include?(-'font') }.transform_values { |v| v.map(&:options).reduce(&:merge) }