Edits the metadata inside a PNG without re-encoding it, as
Storehouse.Image.JPEG does a JPEG's: the same changes, the same tags.
A PNG keeps its metadata in chunks of their own: Exif (eXIf), XMP and
text (iTXt, tEXt, zTXt), the time (tIME). These functions
rewrite those chunks, each with its checksum, and copy every other one,
the image data and what draws it (palette, transparency, colour
profile, an APNG's frames), byte for byte.
strip: :gps- the Exif GPS directory, zeroed, and XMP's GPS properties. The "Raw profile type" text chunks ImageMagick writes, Exif and XMP again in hexadecimal, go too.strip: {:keep, tags}- Exif with only the tags named, the text chunks of those tags (Author,Copyright,Description), and no other text, XMP or time.put: %{artist: _, copyright: _, image_description: _}- written into Exif, and as the text chunksAuthor,CopyrightandDescriptionthat PNG readers show, in place of any before them.
edit_file/3 reads only the metadata chunks into memory. A PNG whose
chunks cannot be read is refused with {:error, :malformed}, one whose
Exif cannot be read with {:error, :malformed_exif}.
Summary
Functions
The PNG with changes made (Storehouse.Image.MetadataEditor): :strip, then :put.
The PNG at from, with changes made (as edit/2), written to to,
with only its metadata in memory. :unchanged when there is nothing to
change, and to is not written.
The named tags its Exif has (Storehouse.Image.JPEG.tags/1), and the text
chunks Author, Copyright and Description as :artist,
:copyright and :image_description where Exif has none.
Types
Functions
@spec edit(binary(), Storehouse.Image.MetadataEditor.changes()) :: {:ok, binary()} | {:error, reason()}
The PNG with changes made (Storehouse.Image.MetadataEditor): :strip, then :put.
@spec edit_file(Path.t(), Path.t(), Storehouse.Image.MetadataEditor.changes()) :: :ok | :unchanged | {:error, reason() | File.posix()}
The PNG at from, with changes made (as edit/2), written to to,
with only its metadata in memory. :unchanged when there is nothing to
change, and to is not written.
The named tags its Exif has (Storehouse.Image.JPEG.tags/1), and the text
chunks Author, Copyright and Description as :artist,
:copyright and :image_description where Exif has none.