enum

ImageOutputFormat

Inherits Enum / Comparable / Value / Object

Constants

JPEG = 0

largest in size, yet quickest in terms of encoding speed

WEBP = 1

~half size of JPEG, 3rd to last in terms of encoding speed

AVIF = 2

smallest in size, yet slowest in terms of encoding speed

PNG = 3

worst quality, 2nd to last in terms of encoding speed

AUTO = 4

placeholder type

Class methods

from_path?(path : Path) : self | Nil

Returns format based on a file extension from the given path, nil otherwise.

Source
from_request?(request : HTTP::Request, formats : Enumerable(self)) : self | Nil

Returns first of formats found to be supported by the request, nil otherwise.

Source
from_request?(request : HTTP::Request, *formats : self) : self | Nil

Returns first of formats found to be supported by the request, nil otherwise.

Source

Instance methods

auto?

Returns true if this enum value equals AUTO

Source
avif?

Returns true if this enum value equals AVIF

Source
extension
Source
extensions
Source
jpeg?

Returns true if this enum value equals JPEG

Source
mime_type
Source
png?

Returns true if this enum value equals PNG

Source
to_slice(image : Vips::Image, **options) : Bytes

Returns image in a self format.

Source
webp?

Returns true if this enum value equals WEBP

Source