Houston, we have a problem... Part 1...

It is certainly not in the same league as having your space craft blow up whilst half-way to the moon, but the unfortunate thing about writing a tool like Niente to keep an eye on how logically-consistent your tagging of your music collection has been over a span of about 23 years is that... it has a horrible tendency to show you've been making silly mistakes all these years!

Here's my current situation, which is indeed a bit of a problem:

In case you are not familiar with Niente's new Quick Aggregate Statistics (QAS) report, let me explain that it shows that of the 17,656 recordings in my music collection 2,165 of them have been mis-catalogued in a logically inconsistent manner with respect to the PERFORMER and ALBUM tags. Even more alarmingly, over 8,100 of my recordings (that's about half of them!) have 'album art issues'.

If I take a look at the album art sizing issues report (Report Menu, Option 9) to see some of the detail that lies behind that ghastly 8000+ errors figure, I see this sort of thing:

Well, at first glance, there's not a lot of completely missing album art: I have at least embedded something most of the time I add a new recording to the collection! I also don't appear to have massively under- or over-sized album art. No: my problem would appear to be that most of my album art is not perfectly square. I have art that's 1411 high by 1396 wide, for example: a difference of 15 pixels is not exactly a killer, is it?

At this point, I could just switch off Niente's insistence on squareness and re-run the QAS report to see the difference:

...and now we see that the non-insistence on square album art knocks the 'bad art' total down by around 6,000 recordings, to "just" 2,112 of them. That's still quite a lot: what are the problems with them?

Well, here we see that I do have 'genuine' problems: some of the album art really is too big and some is ludicrously small.

Now, whether I have to fix up 8000 bits of art or just 2000 of them -it's still a massive pain in the butt! There is, in fact, no way I could realistically fix all of that up by hand within the next couple of years. So there's no way I'm going to try.

I have, instead, scripted a 'fixup album art' shell script which:

  1. Initiates a new Niente scan of album art, so we're working with the latest possible data
  2. Finds all over-sized, under-sized or (optionally) non-square embedded album art
  3. Extracts any such existing embedded album art and resize it to something more reasonable
  4. Wipes the existing embedded album art
  5. Loads back the resized/re-squared album art

I've made the script available to all as an addendum to the Niente User Manual.

By default, artwork that's bigger than 1600 in any one dimension is too big. Any artwork that's smaller than 499 pixels in any one dimension is too small. And artwork should be square. On that basis, the script would handle these scenarios as follows:

  • 2000x2000 artwork -> resized to 1400x1400
  • 2100x1999 artwork -> resized/squared to 1400x1400
  • 1431x1407 artwork -> resized/squared to 1400x1400
  • 1100x1100 artwork -> left untouched (it's already square and its size is neither too large nor too small)
  • 1109x1100 artwork -> resized/squared to 900x900
  • 600x600 artwork -> left untouched (it's already square and its size is neither too large nor too small)
  • 480x512 artwork -> resized/squared to 500x500 (it's squared to its largest dimension, which is then rounded down to 500)
  • 470x480 artwork -> resized/square to 480x480 (it's too small to be enlarged to 500x500, so it's just squared to its largest dimension)

In almost all cases, the script re-sizes things downwards, because that involves no serious, visible image degradation. That is, you are unlikely to notice if a 4000x4000 image is downscaled to 1400x1400. Enlarging a 180x180 picture to 500x500 would be a no-no, though, because spreading small image data over a larger size just results in a bigger blur. Hence, album art that's too small is just squared up a little. I have made a deliberate choice to end up with a standard set of acceptable sizes: 500x500, 900x900 and 1400x1400. That suits me: it might not suit you, but that's how the script's been written. Only already-square, reasonably-sized album art ends up being left untouched at the default settings in consequence.

So how did I get on, running the script against my own music collection? Quite well as it turns out:

It's now down to just 948 problems to fix, a reduction of about 88% and a manageable residue of things to fix up manually. These are the 'intractables', immune to any automated fix:

The top row on this report indicates a weird 'Art Width', with two numbers in the cell, rather than just one: that means Niente hasn't been able to analyze correctly the artwork dimensions for that particular recording, so nothing automated can fix the problem. Artwork dimensions of 9999 indicate another analysis failure, so again: that needs looking at by hand. For the rest, we now have a nice array of perfectly square, but perfectly tiny, album artwork -for which the only reasonable course of action is to find (or re-scan from the CD booklet) bigger album artwork and do a spot of manual re-tagging with the help of Semplice.

So, I still have some work ahead of me... but it's at least plausibly manageable now!

If you want to make your embedded album art more consistent, you are free to download the script from the Niente user manual addendum page. Save it to somewhere convenient (say, your Desktop folder) and then open it in a text editor: I draw your attention to lines 45 to 50 which contain a number of  important variables that need to be set to make things work in different environments and suit your needs better. Chief of these is: the DBNAME needs to be set to the name of your Niente database, and SQUAREART_REQUIRED should be set to 1 or 0, depending on whether you do or don't care about correcting reasonably-sized but non-square album art (e.g., is 913x900 a problem for you or not). MacOS users should change the default GREPPROG parameter value to ggrep, too. You may want to alter the pixel dimensions at which artwork is considered too big or too small, too, but that's up to your tastes. The CONFDIR parameter needs to point to the folder where your Niente database lives: it's set to Niente's default out-of-the-box and shouldn't need changing, unless you've been adventurous in your own Niente setups!

Once you've downloaded and edited the script: take a backup of your music collection!! The script will do things to it you may not like. Make sure you've got a backup you can restore if you hate everything the script ends up doing! I would also recommend copying a small portion of your collection somewhere, creating a new Niente database to scan that copy and then running the script in the first instance against that copy. Check the results. If you're happy, then you can alter the DBNAME parameter to point to your 'real' Niente database (and thus to your original and full music collection). Don't just fire this off against your one and only copy of a valuable music collection, in other words. I have done that and I'm fine with the results, so I have no further qualms: but don't trust that what I'm happy with would suit you!!

To run the script (assuming it's been downloaded to the Desktop folder), you open a terminal session and type something like:

cd $HOME/Desktop
chmod +x fixart.sh
./fixart.sh

The first command makes sure you're sitting in the folder where the script is stored; the second makes the script executable; the third actually runs it.

As you can tell from my Quick Aggregate Statistics report, I have various other substantial issues with my collection which I need to fix up in similar automated fashion, given the scale of them! As I develop more bulk-fixup scripts, I'll release them on that addendum page. They will be functional, not pretty; and I will have tested them against my own music collection. But they'll come when they come and I have no schedule for specific releases. Watch this space, basically...