How to save cover art images as files with filenames same as type of cover art?

I’d like to save cover art images as files with filenames same as type of cover art.
To do this I want to use

Options → Option… → Cover Art → using the following file name for images

but I can’t find any variable or funktion to get the image type of cover art images.
Is there some or if there some plugin that this can do?

You do not need to specify the file type, just the file name. Picard will determine the file type and add the file extension automatically.

Thanks for answering.

I am not worry about file type.

What I want is: If there are more than one picture for cover art, so there can be for example a picture that has cover-art-type “front” and an other that has cover-art-type “back”. I want to save the pictures as “front.png” and “back.png”. There for I am searching for a variable like %cover-art-type% to put this in the input mask:

Options → Option… → Cover Art → using the following file name for
images: %cover-art-type%

Yes, would be useful :slight_smile: This idea sounds familiar, could be it has been discussed before, but a ticket on https://tickets.musicbrainz.org would help :slight_smile:

Current dev version has such feature, but only for CAA as others providers don’t set a type.

It will only use the first image type, and front images will still be named using the default name provided (cover prefix by default).

1 Like

Is this still what happens?

Yes, the option was rephrased a bit though:

So if the last option “Always use primary type” is un ticked, then what happens to artwork with two types? The infamous ‘cover,booklet’ example for instance?

Let’s take this release for example as it has many images and different types:

With no limit on images to be saved.

With this option enabled, it will save image files as:

booklet.jpg
booklet (1).jpg
booklet (2).jpg
booklet (3).jpg
booklet (4).jpg
booklet (5).jpg
booklet (6).jpg
booklet (7).jpg
booklet (8).jpg
booklet (9).jpg
booklet (10).jpg
booklet (11).jpg
cover.jpg
front.jpg
medium.jpg
medium (1).jpg
medium (2).jpg
medium (3).jpg
tray.jpg

Without:

cover.jpg
cover (1).jpg
cover (2).jpg
cover (3).jpg
cover (4).jpg
cover (5).jpg
cover (6).jpg
cover (7).jpg
cover (8).jpg
cover (9).jpg
cover (10).jpg
cover (11).jpg
cover (12).jpg
cover (13).jpg
cover (14).jpg
cover (15).jpg
cover (16).jpg
cover (17).jpg
cover (18).jpg
2 Likes

Not what I was expecting. I thought the tick box applied on a file by file basis… But anyway… If I have a file that has types Front,Booklet. The primary type is Front.

  • is there any way to have two files created/downloaded. One of type Front and saved as cover.jpg and the other booklet.jpg

  • is the downloading of cover art handled by a script anywhere? I’d like to do other things like append the comments to the file name.

Not quite sure what you mean by a “file by file basis”. But all it does is that it saves files that are not of type “front” with the filename set to the type. That’s of course per file. Actually you could achieve something similar by setting the following script as the cover art name:

$if($eq(%coverart_maintype%,front),cover,%coverart_maintype%)

That’s mostly equivalent to using the option. Images of type “front” will be saved as “cover” (or however you name it in the script), everything else will be named by its type, e.g. “booklet” or “medium”.

No, duplicating the downloaded files that way is currently not possible.

You can’t script the download, but you can script the file naming (by using a script in the “use the following filename for images” text field). There is the special %coverart_comment% variable you could use:

cover$if(%coverart_comment%, - %coverart_comment%)

The documentation of this options has a few more details:

https://picard-docs.musicbrainz.org/en/config/options_location.html

4 Likes

Thanks for the information and the link to documentation.

Just to confirm… If there is a single file with the cover in it which is also the first page of the booklet, let’s assume it will have the Primary type of ‘Front’ and a secondary type ‘Booklet’. Other pages of the booklet will be have the type booklet and will download as Booklet(1), Booklet(2) etc…

There’s no way to have two copies downloaded or created on my computer - one called Cover.jpg and the other Booklet.jpg?

The reason why I’d like to do that is so that the file name pattern Booklet* will refer to all of the files with images of the booklet.

The reason for asking about the script is that the other thing I’d like to be able to do is to write metadata into the jpg files - all the usual stuff like album title, artist title and then MB ids. Is there a way to this?
Can this be done in the cover file name mask? What other variables are available? For example Is there anything holding the order/sequence number of the file?

There is currently no built-in way to save the same image twice by type.

The scripting is only generating the filenames for the covers. Picard currently has no tagging support for image files. This would be a valid feature request. But to be honest I doubt anyone would work on this soon. Image metadata is a complete separate beast, and there are more pressing issues for cover art support that need to be tackled. But feel free to open a ticket for it. As an open source project sometimes unexpected contributions tackle some specific issues.

The variables available for the file naming script for cover art are all the normal tags plus the image specific ones documented in the Picard documentation I linked above.

Note that image saving triggers per saved file. So if you use track specific tags in your naming script you would end up with all the images getting saved separately for each track.

2 Likes

Oh, and the image sequence / position numbers might indeed be interesting to have. I could imagine the we have separate %image_number% and %image_type_number% variables available. The first one just is based on the position, the second one is the same but only for the same primary type.

That is something that then could also be used to give unique names to images instead of relying on Picard’s auto numbering on file name conflict.

4 Likes

Could an existing file saving scripts be expanded to do the things I outlined above? Does it run when artwork is saved?

A very hackish way that could work would be by leveraging different naming scripts based on track number.

Let’s say the scripts checks for track number 1 and only saves images with the main type. But if it is not track 1 and the image types contain “booklet” it saves it with name “booklet”.

Will require that there are always at least 2 files being saved, the one for track 1 and at least one other.

Something like this, but untested:

$if($and($not($eq(%tracknumber%,1)),$inmulti(%coverart_types%,booklet)),booklet,$if($eq(%coverart_maintype%,front),cover,%coverart_maintype%))

This should save images that contain the type “booklet” always with the name “booklet”. All images that are not of type booklet or all images on track 1 get saved by the second part, which will save images of maintype “front” as “cover” and all other with the name of the main type.

You must disable “Always use the primary image type as the file name for non-front images” for this to work, as otherwise the naming script is not used for non-front images.

2 Likes

So one naming script for track one and one for all of them?
When do they trigger for artwork files vs music files?

Artwork saving happens after saving the file itself.

So for 14 tracks, the artwork is saved 14 times? I thought MB artwork and saving the artwork files was at the release level?

No, artwork in general is just another piece of metadata which is applied per file. This e.g. happens if you have embedded artwork in the files (and no loaded data that overwrites it). Picard attempts to avoid separate saving the same file multiple times by checking if it got already written.

But the cover art sources actually all work on a release level.

Really the cover art handling has many things that should be improved.

1 Like