Cover Dimensions - another approach


#1

Cover Dimensions - another approach

The following method creates some tag fields to hold cover image related data from up to ten stored covers.

This method relies on a helper tool called identify.exe, taken from the powerful graphical tools suite made by ImageMagick, which can extract technical informations from a picture.
(ImageMagick ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/

1.
In Mp3tag grid view mark the tracks to be changed.

2.
Run the actiongroup 'Get Cover Info Step 1 Export Covers' against the selection.

Begin Actiongroup Get Cover Info Step 1 Export Covers

Action #1
Actiontype 5: Format tag field
Field: COVER_PATH
Formatstring: $replace(%_folderpath%%_filename%,,`,:,)

Action #2
Actiontype 4: Replace with regular expression
Field: COVER_PATH
Regular expression: [^\x2F-\x7F]
Replace matches with:

[_] case sensitive comparison

Action #3
Actiontype 5: Format tag field
Field: COVER_PATH
Formatstring: O:\TEST\COVERS\%COVER_PATH%

Action #4
Actiontype 13: Export cover image to file
Formatstring for image filename: %COVER_PATH%

End Actiongroup Get Cover Info Step 1 Export Covers (4 Actions)

You may change the path to the working folder to fit your needs.
Change in Action #3 the partial string 'O:\TEST\COVERS' to the location of your choice.

Keep in mind that the working folder must be named unique within the later used batch command file resp. export script too.

3.
Run actiongroup 'Get Cover Info Step 2 Create Filelist' against the selection.

This actiongroup creates a textfile in the working folder using the Mp3tag export script 'Export Filelist for ImageMagick identify.mte'.

Begin Actiongroup Get Cover Info Step 2 Create Filelist

Action #1
Actiontype 15: Export
Select script filename: Export÷Filelist÷for÷ImageMagick÷identify
Export filename: O:\TEST\COVERS\identify.in.txt

[X] append data [_] one file per folder

Note: Replace one special character ÷ with one space character.
End Actiongroup Get Cover Info Step 2 Create Filelist (1 Action)

4.
Run actiongroup 'Get Cover Info Step 3 Create Batch' against the selection.

This action creates a batch command file in the working folder.

Do not forget to adapt the working folder setup within the action script to your needs.
Look into the Mp3tag export file 'Export CMD for ImageMagick Identify.cmd' and change the working folder and environment variable APP as needed.

Make sure that the helper application 'identify.exe' from ImageMagick is installed and accessible by the batch command file.

Check working folder and adapt top script line '$filename(O:\TEST\COVERS\Mp3tag.iview.info.cmd,ansi)' as needed.

Begin Actiongroup Get Cover Info Step 3 Create Batch

Action #1
Actiontype 15: Export
Select script filename: Export÷CMD÷for÷ImageMagick÷Identify
Export filename: O:\TEST\COVERS\Mp3tag.magick.identify.cmd

[_] append data [_] one file per folder

Note: Replace one special character ÷ with one space character.
End Actiongroup Get Cover Info Step 3 Create Batch (1 Action)

5.
'Get Cover Info Step 4 Run Batch external' - run the external batch command file in the working folder.

Use some File Explorer and look into the working folder, e. g. 'O:\TEST\COVERS'.

There is a bunch of jpg files as the result from 'Step 1 Export Covers'.

There is a batch command file named 'Mp3tag.magick.identify.cmd'.

Run the batch command file 'Mp3tag.magick.identify.cmd'.

The batch command file creates a bunch of txt files in the working folder and deletes the previously created jpg files.

6.
Switch back to Mp3tag.

Run the actiongroup 'Get Cover Info Step 5 Set Tags from ImageMagick identify' against the selection.

Begin Actiongroup Get Cover Info Step 5 Set Tags from ImageMagick identify

Action #1
Actiontype 14: Import text file
Field: COVER_INFO
Filename: %COVER_PATH%.out.txt

Action #2
Actiontype 4: Replace with regular expression
Field: COVER_INFO
Regular expression: \r*\n
Replace matches with: |

[_] case sensitive comparison

Action #3
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %COVER1_TYPE%%COVER1_SIZE%%COVER1_DIM_W_H%%COVER1_RES_W_H%%COVER1_QUALITY%|%dummy%

Action #4
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%COVER2_TYPE%%COVER2_SIZE%%COVER2_DIM_W_H%%COVER2_RES_W_H%%COVER2_QUALITY%|%dummy%

Action #5
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%COVER3_TYPE%%COVER3_SIZE%%COVER3_DIM_W_H%%COVER3_RES_W_H%%COVER3_QUALITY%|%dummy%

Action #6
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%dummy%|%COVER4_TYPE%%COVER4_SIZE%%COVER4_DIM_W_H%%COVER4_RES_W_H%%COVER4_QUALITY%|%dummy%

Action #7
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%dummy%|%dummy%|%COVER5_TYPE%%COVER5_SIZE%%COVER5_DIM_W_H%%COVER5_RES_W_H%%COVER5_QUALITY%|%dummy%

Action #8
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%COVER6_TYPE%%COVER6_SIZE%%COVER6_DIM_W_H%%COVER6_RES_W_H%%COVER6_QUALITY%|%dummy%

Action #9
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%COVER7_TYPE%%COVER7_SIZE%%COVER7_DIM_W_H%%COVER7_RES_W_H%%COVER7_QUALITY%|%dummy%

Action #10
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%COVER8_TYPE%%COVER8_SIZE%%COVER8_DIM_W_H%%COVER8_RES_W_H%%COVER8_QUALITY%|%dummy%

Action #11
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%COVER9_TYPE%%COVER9_SIZE%%COVER9_DIM_W_H%%COVER9_RES_W_H%%COVER9_QUALITY%|%dummy%

Action #12
Actiontype 7: Import tag fields (guess values)
Source format: %cover_info%
Guessing pattern: %dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%dummy%|%COVER10_TYPE%%COVER10_SIZE%%COVER10_DIM_W_H%%COVER10_RES_W_H%%COVER10_QUALITY%|%dummy%

End Actiongroup Get Cover Info Step 5 Set Tags from ImageMagick identify (12 Actions)

6.
Cleanup Tags.

Run the actiongroup 'Get Cover Info Step 6 Remove Temp Tags' against the selection.

Begin Actiongroup Get Cover Info Step 6 Remove Temp Tags

Action #1
Actiontype 9: Remove fields
Fields to remove (semicolon separated): COVER_PATH;COVER_INFO

End Actiongroup Get Cover Info Step 6 Remove Temp Tags (1 Action)

7.
Cleanup working folder.

Remove all files from the working folder just by running the same batch command file 'Mp3tag.magick.identify.cmd' again.

8.
Add new columns to the Mp3tag grid view.

[#..]
width=100
numeric=0
name=Cover1 Dim
value=[%COVER1_DIM_W_H%]
sort=$mul($replace(%COVER1_DIM_W_H%,'x',','))
field=
enabled=1

[#..]
width=100
numeric=0
name=Cover2 Dim
value=[%COVER2_DIM_W_H%]
sort=$mul($replace(%COVER2_DIM_W_H%,'x',','))
field=
enabled=1

[#..]
width=71
numeric=1
name=Covers Size
value=[$add($add($add($add($add($add($add($add($add(%COVER1_SIZE%,%COVER2_SIZE%),%COVER3_SIZE%),%COVER4_SIZE%),%COVER5_SIZE%),%COVER6_SIZE%),%COVER7_SIZE%),%COVER8_SIZE%),%COVER9_SIZE%),%COVER10_SIZE%)]
sort=
field=
enabled=1

... and so on.

9.
Ready.

Regarding on the number of stored cover pictures and limitation by this method one mp3 file gets a set of five ready made tag fields for each cover picture.

COVERn_TYPE ..: Image file type as string, e. g. 'JPEG'.
COVERn_SIZE ..: Size in Bytes.
COVERn_DIM_W_H: Dimensions width and height pair in pixel, e. g. '179x200'.
COVERn_RES_W_H: Resolution width and height pair in pixel, e. g. '72x72'.
COVERn_QUALITY: Quality of the compressed image in percent, e. g. '85'.

Mp3tag users who do not need those detailed data may use the %COVER_INFO% tag field alone which contains all the data within one string list.
To get the %COVER_INFO% tag field stand alone all 'Import tag fields (guess values)' actions within actiongroup 5 and the string COVER_INFO within actiongroup 6 have to be deleted.

Once you have understood how the workflow runs you may set up two meta actiongroups by the Mp3tag Utils Dialog, e. g.:
GetCover Info Step 1-2-3
GetCover Info Step 4-5-6
... to achieve nearly a single click feeling (hmm ... not really ... overall maybe just 7 clicks?).

Be aware that Mp3tag is somewhat quirky when exporting cover pictures in the case of duplicate pictures stored in one mp file!

Note to the Mp3tag developer:
I would like to have even duplicate pictures to be allowed and to be imported and to be exported each as a single file (just because of logical handling and systematic usage)!
And a a smart wizard background image type repair support too (e. g. auto repair of APIC frame when PNG image is erroneously stored as JPEG type)!

mta files:
Get_Cover_Info_Step_1_Export_Covers.mta ( 221bytes ) Number of downloads: 192
Get_Cover_Info_Step_2_Create_Filelist.mta ( 108bytes ) Number of downloads: 310
Get_Cover_Info_Step_3_Create_Batch.mta ( 114bytes ) Number of downloads: 189
Get_Cover_Info_Step_4_Run_Batch_external.mta ( 3bytes ) Number of downloads: 160
Get_Cover_Info_Step_5_Set_Tags_from_ImageMagick_identify.mta ( 1.62K ) Number of downloads: 197
Get_Cover_Info_Step_6_Remove_Temp_Tags.mta ( 41bytes ) Number of downloads: 152

mte file:
Export_Filelist_for_ImageMagick_identify.mte ( 109bytes ) Number of downloads: 173
Export_CMD_for_ImageMagick_identify.mte ( 3.55K ) Number of downloads: 190

Good luck, folks!
DD.20080310.1015.CET

Edit: some typos corrected.
DD.20080310.1944.CET

Removed old scripts.
DD.20131114.0033.CET


Cover art dimensions
Embedded album art dimensions (height, width)
Filterung nach Alben mit verschiedenen Covern
Request: Column for cover image dimensions
Cover Image Dimensions
AlbumCover
Display Cover Resolution and Cover Description in table view
Auflösung der Cover ermitteln
Spaltenansicht 300 x 300
Can I use cover art dimensions as a column heading?
Suggestion: Album art Resolution sizes
Cover werden nicht angezeigt
kleine Cover filtern
#2

There is a simplification for step 1.

Begin Actiongroup Get Cover Info Step 1 Export Covers

Action #1
Actiontype 5: Format tag field
Field: COVER_PATH
Formatstring: O:\TEST\COVERS\%_COUNTER%

Action #2
Actiontype 13: Export cover image to file
Formatstring for image filename: %COVER_PATH%

End Actiongroup Get Cover Info Step 1 Export Covers (2 Actions)

mta file:
Get_Cover_Info_Step_1_Export_Covers.mta ( 92bytes ) Number of downloads: 159

DD.20080312.1127.CET

Removed old script file.
DD.20131115.0035.CET


#3

There is a replacement for the export mte file which creates the batch command file.
The updated batch command file now can handle different image file types (jpeg, png, ...) which are eventually stored in a mp3 file, and they should appear in correct order too.

mte file:
[old version removed]

DD.20080313.1835.CET


#4

There is a new version of the export mte file.

The updated batch command file works around a DOS DIR sort quirk so that a list of image data should appear in correct order now.

Be aware that the current version Mp3tag 2.40 does not export all stored images in all cases; 'duplicate images' are suppressed on exporting.
Because there is no way from outer space to detect which image at which storage position has been excluded from Mp3tag cover export action, the 'Cover Dimension Identify' method can slightly fail.

Excluding stored images by Mp3tag cover export action can lead the 'Cover Dimension Identify' method to work with a smaller number of 'identified' images than the number of images actually stored, e. g. there are seven images stored and one image is a duplicate, so only six exported images can be 'identified'.
I have the expectation that next version of Mp3tag can handle full export of all stored images, so that the 'Cover Dimension Identify' method will work perfectly without any exceptions.

mte file:
Export_CMD_for_ImageMagick_identify.mte ( 4.34K ) Number of downloads: 216

DD.20080315.2050.CET

Florian, this was rather fast!

... and now cover export delivers all images and 'Cover Dimension Identify' can detect them too.

But now in version Mp3tag 2.40a the writing order of exported images is not the same as the storage order, so that 'Cover Dimension Identify' cannot work correctly, e.g. when image types jpg and png are stored together in a file. So bad.

DD.20080315.2322.CET

Removed old script file.
DD.20131115.0037.CET


#5

In the meantime I've used the 'Cover Dimension Identify' routine repeatedly and didn't receive any quirk (thanks to Florian for better naming support on cover export).

To have a smarter view and handling within Mp3tag I use this special designed column view:
MyCoverView.ini.txt ( 7.46K ) Number of downloads: 190

DD.20080424.1449.CEST

Removed old script file.
DD.20131115.0039.CET


#6

I'm not clear on what you end up with after doing all this. Do you end up with several embedded images in the tags for each file? Do you end up with just links in the tags to the files?


#7

My 'Cover Dimension Identify' routine is simply a helper tool, a workaround, inspirated by request of some Mp3tag users including myself, maybe for now having a state of an addon tool for Mp3tag in the meantime while the provided functionality is not native supported by Mp3tag itself.

The 'Cover Dimension Identify' routine can give you an overview about technical attributes of up to ten images stored in your music files, from within Mp3tag.

After applying the 'Cover Dimension Identify' routine each musicfile holds additional detailed informations about the stored images.

  • Image Size (Bytes)
  • Image Dimensions (Width x Height)
  • Image Resolution (Width x Height)
  • Image Type
  • Image Quality

Using Mp3tag with an appropriate column view you get full overview of all stored images and there image attributes.
The columns are sortable, so you are able to investigate the image data visually, e. g. for proper resolution values.
What you do with this tool at last is up to you and your imagination.

Generally the routine works in four steps:
1.
Within Mp3tag select a group of musicfiles, run some actions against this selection e. g. to export all stored covers into a temporary working folder.
2.
Switch over to the temporary working folder and run the generated batch command file within the temporary working folder. This command file invokes the Imagick identify tool and creates text output files containing image information for each temporary cover image.
3.
Within Mp3tag run some actions to import the external textual image informations into the already selected group of musicfiles. There is no cover import.
4.
Switch over to the temporary working folder and run the same batch command file again. This will clean up the temporary working folder. Do not forget.

Afterwards you are able to evaluate the new imported data as you like it with Mp3tag.

When your work has been finished you are free to delete all imported image information from the musicfiles using Mp3tag e. g. by Action Remove Tag Fields or Dialog Extended Tag View.

DD.20080425.0937.CEST


#8

I see said the blind man as he picked up his hammer and saw.
Now I understand what's going on.

It can be very handy to see the info about cover art dimensions and quality. Lets you know which ones need to be scanned in or searched for better quality images.

I use J River Media Center for my music playing. People over there have been asking for the same type of summary info about cover images. Something to sort by dimensions or quality to identify which images need to be improved.


#9

Hello DetlevD,

I am trying to use your method that would suite my needs perfectly. I've actually made it work once a few months ago but I cannot run it properly now. Apparently the tags are not set up during this phase "3. Within Mp3tag run some actions to import the external textual image informations into the already selected group of musicfiles. There is no cover import."
Right after I run the CMD batch program, I have a list of text files like that in my working directory:
1.!num!.txt
1.out.txt
2.!num!.txt
2.out.txt
...
14.!num!.txt
14.out.txt

When I run the CMD batch program in order to delete the temporary files, the following text files are not deleted :
1.!num!.txt
2.!num!.txt
...
14.!num!.txt

When I take a look at the Cover1 Dim, Cover2 Dim and Covers Size columns, I have nothing.

Could you assist me in troubleshooting / fixing this issue ?

Thanks for your help and time on this matter.

Don


#10

Hello Don, I have no clue what happened at your side to get such problems.
I am really surprised, because your feedback is the one and only since years after rolling out this proposal,
Please give me some time to re-install and to try it out for myself.
What operating system resp. command shell do you use, did you made any modification to the scripts?

DD.20131114.0835.CET


#11

Thank you for getting back to me that quickly !

The modifications I made to the different scripts you posted are (hopefully) only meant to configure the appropriate folders.

I have attached a file that contains all troubleshooting elements I could think of :

  • all the actions .mta files of the Get_Cover_Info
    (located here C:\Users[UserName]\AppData\Roaming\Mp3tag\data\actions
  • the two export .mte files
    (located here C:\Users[UserName]\AppData\Roaming\Mp3tag\export
  • the different files that are created during the process
  • the very basic columns.ini file I use

Thanks again,

Don

[edited @ 9:23 AM EST] : Windows 7 x64 - mp3tag 2.58

Troubleshooting.zip (10.6 KB)


#12

Cover Dimensions - another approach

I have looked through the scripts again and have made ​​small changes here and there.
On my XP machine everything works as it should.

There is an archive file attached containing all files needed.

20131114.Mp3tag.GetCoverInfo.rar ( 73.77K ) Number of downloads: 3

20131116.Mp3tag.GetCoverInfo.rar (76.2 KB)

DD.20131115.0030.CET
DD.20131116.0730.CET

20131116.Mp3tag.GetCoverInfo.rar (76.2 KB)


#13

Hello DetlevD,

thanks for your investigations and the attached file.

I have tried again to configure and use all your files without success. Just to be sure when running the .cmd batch the second time, should all .txt files be deleted ?

I will try to find a Windows XP machine next week to go further.

Thanks again,

Don



#14

Yes, the second call to the batch cmd file removes all txt files including itself from the working folder.

Don, please verify that the CMD.EXE processor option "EnableDelayedExpansion" is enabled, when executing the batch cmd files.
Note: EnableDelayedExpansion is Disabled by default.

EnableDelayedExpansion may be enabled by starting CMD with the /v:on switch.

EnableDelayedExpansion can also be set in the registry:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor]
"DelayedExpansion"= (REG_DWORD)
1=enabled 0=disabled (default)

... or use this reg file ...
CMD.EnableDelayedExpansion.reg.txt (470 Bytes)
Remove the extension ".txt" and import this reg file into the registry.

DD.20131115.2109.CET

CMD.EnableDelayedExpansion.reg.txt (470 Bytes)


#15

Yes !!!! It worked !!!!

After modifying the registry with your .reg file, I retried and successfully completed the whole process.
The number of text files created was actually different on step#3.

Your help is VERY much appreciated Sir.

Take care,

Don


Sort by Album Art Resolution?
Sort by Album Art Resolution?