# Cover Dimensions

**URL:** https://community.mp3tag.de/t/cover-dimensions/6397
**Category:** General Discussion
**Created:** [March 6, 2008, 7:50pm UTC](https://community.mp3tag.de/t/cover-dimensions/6397 "2008-03-06T19:50:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [March 6, 2008, 7:50pm UTC](https://community.mp3tag.de/t/cover-dimensions/6397/1 "2008-03-06T19:50:58Z")

</div>

**Cover Dimensions**

The following method creates two tag fields to hold the wide and height values from the first stored cover.

You need a helper tool called **IrfanView** which extracts the information from the picture.

**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.

**3.**  
Run actiongroup **Get Cover Info Step 2 Create Batch** against the selection.

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

**4.**  
**Get Cover Info Step 3 Run Batch**

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 the previous actiongroup run.

There is a txt file named 'Mp3tag.iview.info.cmd.txt'.

To set the batch command file ready to work just delete the extension '.txt' to name it 'Mp3tag.iview.info.cmd'.

Make sure that the helper application 'IrfanView' (i\_view32.exe) is installed and accessible by the batch command file.  
Look into the Mp3tag export file 'Export BAT for IrfanView Info.mte' and change the environment variable APP as needed.  
Change the working folder to the same folder as before, see line  
'$filename(O:\TEST\COVERS\Mp3tag.iview.info.cmd.txt,ansi)'.

Run the batch command file 'Mp3tag.iview.info.cmd'.

The batch command file creates a bunch of txt files in the working folder.

**5.**  
Switch back to Mp3tag.

Run the actiongroup **Get Cover Info Step 4 Set Tags** against the selection.

Begin Actiongroup **Get Cover Info Step 4 Set Tags**

Action #1  
_Actiontype 14:_ **Import text file**  
_Field:_ **COVER\_INFO**  
_Filename:_ **%COVER\_PATH%.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 5:_ **Format tag field**  
_Field:_ **COVER\_WIDTH**  
_Formatstring:_ **%COVER\_INFO%**

Action #4  
_Actiontype 5:_ **Format tag field**  
_Field:_ **COVER\_HEIGHT**  
_Formatstring:_ **%COVER\_INFO%**

Action #5  
_Actiontype 4:_ **Replace with regular expression**  
_Field:_ **COVER\_WIDTH**  
_Regular expression:_ **^(._Image÷dimensions÷=÷)(\d+)(÷x÷)(\d+)(÷÷Pixels._)$**  
_Replace matches with:_ **$2**

[X] case sensitive comparison

Action #6  
_Actiontype 4:_ **Replace with regular expression**  
_Field:_ **COVER\_HEIGHT**  
_Regular expression:_ **^(._Image÷dimensions÷=÷)(\d+)(÷x÷)(\d+)(÷÷Pixels._)$**  
_Replace matches with:_ **$4**

[X] case sensitive comparison

Note: Replace one special character ÷ with one space character.  
End Actiongroup **Get Cover Info Step 4 Set Tags** (6 Actions)

**6.**  
Cleanup.

Run the actiongroup **Get Cover Info Step 5 Remove Temp Tags** against the selection.

Begin Actiongroup **Get Cover Info Step 5 Remove Temp Tags**

Action #1  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **COVER\_PATH;COVER\_INFO**

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

Remove all files from the working folder.

**7.**  
Add new columns to the Mp3tag grid view.

[#..]  
width=72  
numeric=1  
name=Cover Width  
value=%COVER\_WIDTH%  
sort=  
field=  
enabled=1

[#..]  
width=72  
numeric=1  
name=Cover Height  
value=%COVER\_HEIGHT%  
sort=  
field=  
enabled=1

or combine the two values in one column

[#..]  
width=100  
numeric=0  
name=Cover Dim  
value=[%COVER\_WIDTH% x %COVER\_HEIGHT%]  
sort=$mul(%COVER\_WIDTH%,%COVER\_HEIGHT%)  
field=  
enabled=1

**8.**  
Ready.

mta files:  
[Get\_Cover\_Info\_Step\_1\_Export\_Covers.mta](https://community.mp3tag.de/uploads/default/original/1X/ce24fece88772e753fb336388c03ad73e855679b.mta) (221 Bytes)  
[Get\_Cover\_Info\_Step\_2\_Create\_Batch.mta](https://community.mp3tag.de/uploads/default/original/1X/73b5b39af83e51736a1733fea44f325e01089471.mta) (107 Bytes)  
[Get\_Cover\_Info\_Step\_3\_Run\_Batch\_external.mta](https://community.mp3tag.de/uploads/default/original/1X/57218c316b6921e2cd61027a2387edc31a2d9471.mta) (3 Bytes)  
[Get\_Cover\_Info\_Step\_4\_Set\_Tags.mta](https://community.mp3tag.de/uploads/default/original/1X/98bb9b24c7ca7a3d0d37b79f394b41e0ba12d37c.mta) (393 Bytes)  
[Get\_Cover\_Info\_Step\_5\_Remove\_Temp\_Tags.mta](https://community.mp3tag.de/uploads/default/original/1X/48e4d801081270330080fe8d023bbcfdadf616a0.mta) (41 Bytes)

mte file:  
[Export\_BAT\_for\_IrfanView\_Info.mte](https://community.mp3tag.de/uploads/default/original/1X/7a9a3f035a89dc5056b8fab7785339ff9d0eb797.mte) (1.69 KB)

Good luck, folks!

(How easy would it be to have cover dimension support by native Mp3tag!)  
DD.20080306.2130.CET

[Get\_Cover\_Info\_Step\_2\_Create\_Batch.mta](https://community.mp3tag.de/uploads/default/original/1X/73b5b39af83e51736a1733fea44f325e01089471.mta) (107 Bytes)

[Get\_Cover\_Info\_Step\_3\_Run\_Batch\_external.mta](https://community.mp3tag.de/uploads/default/original/1X/57218c316b6921e2cd61027a2387edc31a2d9471.mta) (3 Bytes)

[Get\_Cover\_Info\_Step\_4\_Set\_Tags.mta](https://community.mp3tag.de/uploads/default/original/1X/98bb9b24c7ca7a3d0d37b79f394b41e0ba12d37c.mta) (393 Bytes)

[Get\_Cover\_Info\_Step\_5\_Remove\_Temp\_Tags.mta](https://community.mp3tag.de/uploads/default/original/1X/48e4d801081270330080fe8d023bbcfdadf616a0.mta) (41 Bytes)

[Export\_BAT\_for\_IrfanView\_Info.mte](https://community.mp3tag.de/uploads/default/original/1X/7a9a3f035a89dc5056b8fab7785339ff9d0eb797.mte) (1.69 KB)

[Get\_Cover\_Info\_Step\_1\_Export\_Covers.mta](https://community.mp3tag.de/uploads/default/original/1X/ce24fece88772e753fb336388c03ad73e855679b.mta) (221 Bytes)

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [March 6, 2008, 8:51pm UTC](https://community.mp3tag.de/t/cover-dimensions/6397/2 "2008-03-06T20:51:48Z")

</div>

Great work!

> [@DetlevD](#):
>
> (How easy would it be to have cover dimension support by native Mp3tag!)

and 100% ACK!! ![:w00t:](https://community.mp3tag.de/uploads/default/original/1X/cb01eca72fe9339ff6f3ec9f1e3c5fe002be0f0a.gif ":w00t:")

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [March 7, 2008, 6:36am UTC](https://community.mp3tag.de/t/cover-dimensions/6397/3 "2008-03-07T06:36:49Z")

</div>

I think it would be easy for Florian to support right now a tag field containing a list of width-height-dimension pairs of all stored covers, e. g. '200 x 200\\179 x 150\\1141 x 1141' (using the Mp3tag multiple field delimiter) or '200x200|179x150|1141x1141' (using some user defined delimiter).

If there would be such a function ...

```
$ItemExtract
Returns the selected item from a list.

Syntax:
$ItemExtract (index, list, delimiter)

Parameters:
(i) index: the position in list of the item to be selected.
(s) list: a string containing a list of items.
(s) delimiter: a character to act as a delimiter between items in the list.

Returns:
(s) the selected item.

Note: Using -1 as the index will return the last item in the list. 

```

... someone could easily extract one dimension pair out of the list regarding the n-th stored cover.

Example:  
Tagfield COVER\_DIMS holds '200x200|179x150|1141x1141'.

$ItemExtract(2,%COVER\_DIMS%,'|') will give '179x150' (pair of dimensions of the second cover).

Using the same function again on the extracted pair someone could easily extract both dimension values separately.  
$ItemExtract($ItemExtract(2,%COVER\_DIMS%,'|'),1,'x') will give '179' (width value of the second cover.  
$ItemExtract($ItemExtract(2,%COVER\_DIMS%,'|'),2,'x') will give '150' (height value of the second cover.

DD.20080307.0838.CET

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 13, 2022, 7:53am UTC](https://community.mp3tag.de/t/cover-dimensions/6397/4 "2022-04-13T07:53:42Z")

</div>

This is built-in since Mp3tag v2.88

| | |
| --- | --- |
| %\_cover\_height% | Cover height of first cover art in the tag of the file in pixels |
| %\_cover\_width% | Cover width of first cover art in the tag of the file in pixels |

See more cover-related placeholders in the [documentation](https://docs.mp3tag.de/format/#technical-information).

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [May 13, 2022, 7:53am UTC](https://community.mp3tag.de/t/cover-dimensions/6397/5 "2022-05-13T07:53:43Z")

</div>

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