Sha256: 72d6ee91771c355c682d7eec632d0d6d4718e46fe74e3f022fc9eeeac6398b7c
Contents?: true
Size: 913 Bytes
Versions: 8
Compression:
Stored size: 913 Bytes
Contents
require "numo/narray" require "dnn/ext/image_io/image_io_ext" module DNN module ImageIO private_class_method :_read private_class_method :_write_bmp private_class_method :_write_png private_class_method :_write_jpg def self.read(file_name) raise ImageIO::ReadError.new("#{file_name} is not found.") unless File.exist?(file_name) _read(file_name) end def self.write(file_name, nary, quality: 100) case file_name when /\.png$/ _write_png(file_name, nary) when /\.bmp$/ _write_bmp(file_name, nary) when /\.jpg$/ _write_jpg(file_name, nary, quality) end rescue => ex raise ImageIO::WriteError.new(ex.message) end end class ImageIO::Error < StandardError; end class ImageIO::ReadError < ImageIO::Error; end class ImageIO::WriteError < ImageIO::Error; end end
Version data entries
8 entries across 8 versions & 1 rubygems