1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl -w
use MP3::Tag;
use strict;
use warnings;
# new MP3::Tag Object with mp3 file
my $filepath = "test.mp3";
my $mp3 = MP3::Tag->new($filepath);
$mp3->get_tags();
#get image data
my $id3v2_tagdata = $mp3->{ID3v2};
my $info = $id3v2_tagdata->get_frame("APIC");
my $imgdata = $$info{'_Data'};
$mp3->close();
# write image data to file
open (COVER, ">test.jpeg");
print COVER "$imgdata";
close (COVER);