Remove cover art with mp3agic

1.8k Views Asked by At

I'm using mp3agic to edit mp3 tags automatically, so that my radio displays everything the way I like it. However, my radio seems to hate big album art images, resulting in not parsing the rest of the mp3 tag. Hence, I want to use mp3agic to remove all cover art. There is a method named ID3v2.setAlbumImage(byte[] albumImage, String mimeType) which is implemented by the AbstractID3v2Tag as seen here. First I thought about throwing in null values, but after looking at the code this has no effect.

Question: How can I delete existing album art with the setAlbumImage method? Is there a better suited method?

4

There are 4 best solutions below

0
On

Take a look at this example for retagging: https://github.com/mpatric/mp3agic-examples/blob/master/src/main/java/com/mpatric/mp3agic/app/Mp3Retag.java#L94

This might be the best solution, because you can not delete but just read and write the image as far as I know.

I hope this helps you to find a solution

0
On

Maybe you could read the existing tag, remove it and then rewrite the tag with the fields that you wanted in the target file.

0
On

Short Answer

According to the current javadoc [that I didn't find online, only by compiling the current source myself] that can be done by using the

clearAlbumImage();

function of the ID3v2 interface.


Example

Here's an example on how to use it:

Mp3File mp3file = new Mp3File("example.mp3");

ID3v2 id3v2Tag;

if (mp3file.hasId3v2Tag()) {
    id3v2Tag = mp3file.getId3v2Tag();
} else {
    id3v2Tag = new ID3v24Tag();
    mp3file.setId3v2Tag(id3v2Tag);
}

id3v2Tag.clearAlbumImage();
mp3file.save("example.mp3");
0
On

There is no easy way to remove album images through the exposed methods. I've added a new issue to the project in github to have this feature added.

https://github.com/mpatric/mp3agic/issues/46