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:
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
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
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: |
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
