ID3 v1.0.1 ID3.Picture View Source

A struct representing a picture in the ID3 tag. See https://docs.rs/id3/0.3.0/id3/frame/struct.Picture.html

PictureType

Due to limitations of rust-id3, multiple pictures with same picture_type is not available. When writing, a picture with the same picture_type within the existing tab, will overwrite that picture. When reading, rust-id3 only returns one of the picture of the same type.

Link to this section Summary

Types

Types of pictures used in APIC frames.

t()

A structure representing an ID3 picture frame's contents.

Link to this section Types

Link to this type

picture_type()

View Source
picture_type() ::
  :Other
  | :Icon
  | :OtherIcon
  | :CoverFront
  | :CoverBack
  | :Leaflet
  | :Media
  | :LeadArtist
  | :Conductor
  | :Band
  | :Composer
  | :Lyricist
  | :RecordingLocation
  | :DuringRecording
  | :DuringPerformance
  | :ScreenCapture
  | :BrightFish
  | :Illustration
  | :BandLogo
  | :PublisherLogo

Types of pictures used in APIC frames.

Link to this type

t()

View Source
t() :: %ID3.Picture{
  data: :binary,
  description: String.t(),
  mime_type: String.t(),
  picture_type: picture_type()
}

A structure representing an ID3 picture frame's contents.

  • data is a binary of unsigned char(8bit)s.
  • picture_type will be :Other otherwise correctly given.

Link to this section Functions

Link to this function

new(data, mime_type, options \\ [])

View Source
new(binary(), String.t(), options :: [option]) :: {:ok, Picture.t()} | :error
when option: {:picture_type, picture_type()} | {:description, String.t()}

Creates a new Picture.

Needs the data binary and the MIME type of the data.

Options

  • picture_type: ID3 tags can have a picture for each type. One of t:Picture.picture_type/0.
  • description: Text description about the picture.

Examples

iex> data = File.read!("full/path/to/foo.jpg")
iex> ID3.Picture.new(data, "image/jpeg", picture_type: :CoverFront)
{:ok,
  %ID3.Picture{
    data: <<255, 167, ...>>,
    description: "",
    mime_type: "image/jpeg",
    picture_type: :CoverFront
  }
}