# Exporting coverart as filename is not saving exactly as it should

**URL:** https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670
**Category:** Support
**Created:** [May 11, 2018, 11:35am UTC](https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670 "2018-05-11T11:35:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![irishwill2008](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/i/eb9ed0/32.png) [@irishwill2008](https://community.mp3tag.de/u/irishwill2008)
#### Post date: [May 11, 2018, 11:35am UTC](https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670/1 "2018-05-11T11:35:41Z")

</div>

Hi there,

I wrote an action that will export coverart as filename and works great until i noticed a small issue.

If i have a filename like: "Rihanna - Work .mp3" \<-- Notice the space after "k" in work.  
If i run my export cover action i get "Rihanna - Work.jpg" \<-- No space? This is incorrect as i need it to be exactly the same as the filename itself with the ending space if it exists.

My action setup:  
Export cover to file "%_filename_%"

Now! If i use: Export cover to file "%\_filename\_ext%",  
i receive: "Rihanna - Work .mp3.jpg" \<-- The space gets included in this but obiously i dont need the .mp3 (file extension). Perhaps theres something i can do with this?

P.s, i even tried: $replace(%\_filename\_ext%,.mp3,) as this will allow me to replace .mp3 and be left with "k .jp" but it still replaces and removes my space!

Any help is appreciated.

Thanks!

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [May 11, 2018, 1:48pm UTC](https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670/2 "2018-05-11T13:48:42Z")

</div>

I can't do anything about the vanishing space character.  
But, perhaps if you use the $trim() function when you import the jpgs again, you succeed:  
Import cover from file: $trim(%artist% - %album%).jpg

Just as a footnote: there are far more threads in this forum that deal with the topic of getting rid of leading or trailing blanks than there are that want to preserve them.

---

<div class="post-metadata">

### Author: ![irishwill2008](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/i/eb9ed0/32.png) [@irishwill2008](https://community.mp3tag.de/u/irishwill2008)
#### Post date: [May 11, 2018, 2:15pm UTC](https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670/3 "2018-05-11T14:15:47Z")

</div>

Sadly i need it to work off the filename as the system i use uses the mp3 filename and replaces .mp3 with .jpg etc. Very complicated to explain here but sadly i need it to work with filename. Your idea wont work with me. I need to make an image named EXACTLY whats on the mp3 filename even if it has ending spaces! To be honest, the content im parsing is old and the new content never has ending space but sadly removing the space is not an option here as it will mess up our references etc in our DB. On a side note, why the hell did the devs design it so it removes ending spaces? If i want the spaces removed i would do it myself.. Simple task, name it from filename. Leave whats in the filename alone and dont replace or remove anything inside!! Was just testing the replace function and same thing? What if i want to replace the last letter with a space?? It wont work! (Your space vanishes anyway xD) Cant stress how angry i am with this.. Stupidily designed. .\_.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [May 11, 2018, 4:22pm UTC](https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670/4 "2018-05-11T16:22:45Z")

</div>

> [@irishwill2008](#):
>
> On a side note, why the hell did the devs design it so it removes ending spaces?

there is a thread from 2010:

> [@MP3tag can't handle spaces in filename between file name and .mp3](https://community.mp3tag.de/t/mp3tag-cant-handle-spaces-in-filename-between-file-name-and-mp3/10865/3):
>
> There is an entry in the Change Log ... [2010-03-13] REL: VERSION 2.46 (for Windows XP/2003/Vista/2008/7) [2010-03-10] FIX: blanks before extension part in file names were automatically removed at Replace actions for \_FILENAME. Points your discussion post to this fact? If so, then there might be something to report relating to Mp3tag 2.46c. The Return of the Bug -.-.--.=.`oo´ Having a filebasename of "test .mp3" and using action "Replace" to replace the string part "test" with nothin…

> [@irishwill2008](#):
>
> Stupidily designed.

Talking about design questions:

> [@irishwill2008](#):
>
> sadly removing the space is not an option here as it will mess up our references etc in our DB

I wonder if the DB is really designed in such a way that one cannot adapt the references so that the files without trailing space will be found again ...

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [May 12, 2018, 6:54am UTC](https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670/5 "2018-05-12T06:54:39Z")

</div>

@irishwill2008  
I can offer your 2 workarounds:

1. If the amount of files with space isn't too large you could filter them with `%_filename% HAS " .mp3"` and do the extraction manually file for file with a right mouse click on the cover in the tagpanel and "extract cover". This way the space remains at its place. The filename can be predefined to  
`%_filename%`  
in  
`File -> Options -> Tag Sources -> Default file name for cover art`.

2. You could use %\_filename\_ext% and later rename the file (getting rid the the .mp3) externally i.e. with a tool like bulk-rename or even someway internally with using the tools options of Mp3Tag.

---

<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: [February 9, 2026, 12:27pm UTC](https://community.mp3tag.de/t/exporting-coverart-as-filename-is-not-saving-exactly-as-it-should/41670/6 "2026-02-09T12:27:25Z")

</div>


