Class: EmbedXMP::WebP

Inherits:
RIFF show all
Defined in:
lib/embed_xmp/webp.rb

Overview

WebP images

Constant Summary collapse

WEBP_HEAD =
'WEBP'
VP8X_HEAD =
'VP8X'
VP8F_HEAD =
'VP8 '
VP8L_HEAD =
'VP8L'
XMPS_HEAD =
'XMP '
VP8X_XMP_FLAG =
0b00000100

Constants inherited from RIFF

RIFF::RIFF_HEAD

Instance Method Summary collapse

Methods inherited from RIFF

#chunk, #new_chunk, #remove_chunk, #replace_chunk, #update_file_length_header

Methods inherited from ImageFile

#initialize, #insert_into_file, #read_io_or_string, #write

Constructor Details

This class inherits a constructor from EmbedXMP::ImageFile

Instance Method Details

#file_headerObject



27
28
29
30
31
32
33
# File 'lib/embed_xmp/webp.rb', line 27

def file_header
  riff_id, file_length, form_type = super

  raise 'NoWEBPHeader' if WEBP_HEAD != form_type

  [riff_id, file_length, form_type]
end

#join_sidecar(sidecar_file, xpacked: false) ⇒ Object

Join an XMP sidecar into the image file.



20
21
22
23
24
25
# File 'lib/embed_xmp/webp.rb', line 20

def join_sidecar(sidecar_file, xpacked: false)
  remove_xmp

  xmp_data = read_io_or_string(sidecar_file)
  upsert_xmp_chunk(create_xmp_chunk(xmp_data, xpacked))
end