Mp3File song = new Mp3File(filename); if (song.hasId3v2Tag()){ ID3v2 id3v2tag = song.getId3v2Tag(); byte[] imageData = id3v2tag.getAlbumImage(); //converting the bytes to an image BufferedImage img = ImageIO.read(new ByteArrayInputStream(imageData)); }
protected void extractPics() throws IOException { ID3v2 id3v2tag = mp3file.getId3v2Tag(); if (id3v2tag != null) { String mimeType = id3v2tag.getAlbumImageMimeType(); byte[] data = id3v2tag.getAlbumImage(); String filename = chooseFilename(mimeType); RandomAccessFile file = null; try { file = new RandomAccessFile(filename, "rw"); file.write(data); } finally { try { if (file != null) { printOut(" Extracted " + filename); file.close(); } } catch (IOException e) { // do nothing } } } }
byte[] imageData = id3v2Tag.getAlbumImage(); if (imageData != null) { String mimeType = id3v2Tag.getAlbumImageMimeType();
public byte[] getAlbumImage() { if (id3v2Tag != null) { return id3v2Tag.getAlbumImage(); } else { return null; } }
public byte[] getAlbumImage() { if (id3v2Tag != null) { return id3v2Tag.getAlbumImage(); } else { return null; } }
Mp3File song = new Mp3File(filename); if (song.hasId3v2Tag()){ ID3v2 id3v2tag = song.getId3v2Tag(); byte[] imageData = id3v2tag.getAlbumImage(); //converting the bytes to an image BufferedImage img = ImageIO.read(new ByteArrayInputStream(imageData)); }
boolean hasId3v2Tag = mp3file.hasId3v2Tag(); boolean hasImage = false; if (hasId3v2Tag && mp3file.getId3v2Tag().getAlbumImage() != null) hasImage = true; if (! hasId3v1Tag && ! hasId3v2Tag) { printError("ERROR processing \"" + FileUtils.extractFilename(filename) + "\" - no ID3 tags found"); if (! hasId3v1Tag) message.append(", added ID3v1 tag"); if (! hasId3v2Tag) message.append(", added ID3v2 tag"); if (! hasImage && mp3file.getId3v2Tag().getAlbumImage() != null) { message.append(", added album image");