pub fn get_embedded_art(track_path: &str) -> Result<Option<DynamicImage>>Expand description
Extracts the first embedded picture from an ID3 tag of an Audio file.
§Arguments
track_path- The path to the Audio file.
§Returns
Returns a Result containing a TempFile object with the contents of the extracted picture, or None if the MP3 file doesn’t have any embedded pictures.
In case of error, the Result will contain an error value of type std::io::Error.
§Example
ⓘ
let result = get_embedded_art("/path/to/track.mp3");
match result {
Ok(Some(dynamic_image)) => {
// Use the image....
println!("Track has an embedded picture {dimensions:?}", dimensions = dynamic_image.dimensions());
}
Ok(None) => println!("Track does not have an embedded picture"),
Err(error) => println!("Error: {}", error),
}