lib/image_processing/mini_magick.rb
# Converts the given color value into an identifier ImageMagick understands.
# This supports specifying RGB(A) values with arrays, which mainly exists
# for compatibility with the libvips implementation.
Converts the given color value into an identifier ImageMagick understands.
This supports specifying RGB(A) values with arrays, which mainly exists
for compatibility with the libvips implementation.
Converts the given color value into an identifier ImageMagick understands . This supports specifying RGB ( A ) values with arrays which mainly exists for compatibility with the libvips implementation .
def color(value)
        return "rgba(255,255,255,0.0)" if value.to_s == "transparent"
        return "rgb(#{value.join(",")})" if value.is_a?(Array) && value.count == 3
        return "rgba(#{value.join(",")})" if value.is_a?(Array) && value.count == 4
        return value if value.is_a?(String)
        raise ArgumentError, "unrecognized color format: #{value.inspect} (must be one of: string, 3-element RGB array, 4-element RGBA array)"
      end
def color ( value ) return "rgba(255,255,255,0.0)" if value . to_s == "transparent" return "rgb(#{value.join(",")})" if value . is_a? ( Array ) && value . count == 3 return "rgba(#{value.join(",")})" if value . is_a? ( Array ) && value . count == 4 return value if value . is_a? ( String ) raise ArgumentError , "unrecognized color format: #{value.inspect} (must be one of: string, 3-element RGB array, 4-element RGBA array)" end
Converts the given color value into an identifier ImageMagick understands.
Converts the given color value into an identifier ImageMagick understands .
value