Import Cover Pic Only if File is Larger than Current?

Any suggestions on how I would script a command to only import the cover pic only if it is larger than the cover pic currently associated with the sound file?

I currently have things set to import any cover pic file I have in the directory. Then I manually go through each file and compare the pic sizes & delete all but the largest cover pic.

However, I'm wondering if I can fine-tune my script so it only imports a newer file if it is larger than the one currently associated with the file, and if there is no pic already associated, then import the largest of the files in the directory.

I'm not a stellar scripter and it usually takes me hours of trial and error, so I thought I'd ask those with more experience. Any suggestions on how I could script this?

Unless there is an indicator in the filename of the external picture file I see very little chance to get this automated.
And even then you would have to export the existing files as well, also with a name part that leads to the correct sort-order in the file system so that MP3tag could take the first file it finds and that should be the desired one.

Edit: I kept on thinking. I don't know how much time the manual way would consume ...
So here is a way in rough sketches for which the details would have to be worked out:

Save the size or dimensions of the current picture in a user-defined field.
Export all old pictures to a file with e.g. the pattern %title%_old.
Import the new files.
Compare the size or dimensions of the current (new) files with the data in the user-defined field by using a filter, e.g.
%old_width% GREATER %_cover_width%
for these files the old file would have been better.
So import the old files with an action of the type "Import cover from file" with
%title%_old.jpg
and overwrite the existing covers.

MP3Tag is also able to show the cover dimensions (%_cover_width%;%_cover_height%) of not embedded cover-files. So a sorting by the path in Mp3Tag can group sound-files and cover-files together and with defining a column for %_cover_width% or %_cover_height% you can see at one glance which one is larger in it's dimensions. You have to add *.jpg;*.png in "Tools->Options->Tags->Restrict incoming files to".

In the whole thing, you should also keep in mind that size can mean different things. On the one hand there are the dimensions, on the other hand the size in bytes.
I think that the most important thing for you is the quality of the pictures.
However, an image with large dimensions may well be of poorer quality than an image with smaller dimensions. In practice, I keep noticing that there are covers circulating on the Internet that are large but of relatively poor quality. When saving, an image with a low resolution was "inflated".

When it comes to finding the best compromise between embedded cover size in bytes and quality, my visual testing experience has shown that going for a high resolution and higher compression level is better than a lower resolution and lower compression level.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.