Class: Xberg::ImageOutputFormatHeif

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

Overview

Re-encode all extracted images as HEIF/HEIC 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.

The encode path requires the heic feature; on builds without it, selecting this variant returns an EncodeFailed warning and leaves the image untouched.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#qualityObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



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

def quality
  @quality
end

Class Method Details

.from_hash(hash) ⇒ Object



191
192
193
# File 'lib/xberg/native.rb', line 191

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

Instance Method Details

#heif?Boolean

Returns:

  • (Boolean)


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

def heif? = true

#jpeg?Boolean

Returns:

  • (Boolean)


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

def jpeg? = false

#native?Boolean

Returns:

  • (Boolean)


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

def native? = false

#png?Boolean

Returns:

  • (Boolean)


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

def png? = false

#svg?Boolean

Returns:

  • (Boolean)


187
188
189
# File 'lib/xberg/native.rb', line 187

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

#webp?Boolean

Returns:

  • (Boolean)


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

def webp? = false