Class: Xberg::ImageOutputFormatWebp

Inherits:
Data
  • Object
show all
Extended by:
T::Sig
Includes:
ImageOutputFormat
Defined in:
lib/xberg/native.rb

Overview

Re-encode all extracted images as WebP at the given quality level.

quality must be in 1..=100. Values outside this range are clamped and a warning is emitted. 80 is a reasonable default.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#qualityObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



145
146
147
# File 'lib/xberg/native.rb', line 145

def quality
  @quality
end

Class Method Details

.from_hash(hash) ⇒ Object



168
169
170
# File 'lib/xberg/native.rb', line 168

def self.from_hash(hash)
  new(quality: hash[:quality] || hash["quality"])
end

Instance Method Details

#heif?Boolean

Returns:

  • (Boolean)


162
# File 'lib/xberg/native.rb', line 162

def heif? = false

#jpeg?Boolean

Returns:

  • (Boolean)


158
# File 'lib/xberg/native.rb', line 158

def jpeg? = false

#native?Boolean

Returns:

  • (Boolean)


154
# File 'lib/xberg/native.rb', line 154

def native? = false

#png?Boolean

Returns:

  • (Boolean)


156
# File 'lib/xberg/native.rb', line 156

def png? = false

#svg?Boolean

Returns:

  • (Boolean)


164
165
166
# File 'lib/xberg/native.rb', line 164

def svg? = false
# @param hash [Hash] deserialized from the native extension
# @return [self]

#webp?Boolean

Returns:

  • (Boolean)


160
# File 'lib/xberg/native.rb', line 160

def webp? = true