# Export image from URL in custom field

**URL:** <https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442>\
**Category:** Export\
**Created:** [December 9, 2015, 6:40am UTC](https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442 "2015-12-09T06:40:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KrissO](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/96bed5/32.png) [@KrissO](https://community.mp3tag.de/u/KrissO)\
**Post date:** [December 9, 2015, 6:40am UTC](https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442/1 "2015-12-09T06:40:01Z")

</div>

Hi,

Say I have an ID3 tag with an url to a jpeg.  
How can I export this jpeg directly to a file?

Thanks.

---

<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:** [December 9, 2015, 3:45pm UTC](https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442/2 "2015-12-09T15:45:45Z")

</div>

> [@KrissO](#):
>
> Hi, Say I have an ID3 tag with an url to a jpeg. How can I export this jpeg directly to a file? Thanks.

I assume you want to access an external file given by the URL and store a copy as a local file.  
From within different Windows applications it is possible to load or access files by an URL.  
Also ... executing an URL string at the CMD processor command line or at the Explorer address line, will download the named URL object and will start some application, which is on your system responsible for the given file type ... for example ... executing the following URL on the commandline will start your standard graphic application and will load the file given by the URL.

```
URL Examples ... 
http://forums.mp3tag.de/uploads/av-11458.png
http://forums.mp3tag.de/uploads/av-3194.png
http://forums.mp3tag.de/style_emoticons/default/huh.gif

```

Unfortunately this does not work in Mp3tag in the formatstring dialog of the action "Import cover from file".  
And I assume, that referencing a tag-field with a stored URL will also not work.  
At least it does not work for me with Mp3tag v2.72b on Win XP.

So you may create and apply an Mp3tag export script, which exports the content of the tagfield, i. e. the stored URL, into a self made "bat" or "cmd" command file or such, and let retrieve and store the image file with the given URL, by executing some graphical exe application (e. g. Irfanview.exe, convert.exe from ImageMagick or whatever else).

DD.20151209.1802.CET

---

<div class="post-metadata">

**Author:** ![KrissO](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/96bed5/32.png) [@KrissO](https://community.mp3tag.de/u/KrissO)\
**Post date:** [December 9, 2015, 5:32pm UTC](https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442/3 "2015-12-09T17:32:11Z")

</div>

QUOTE (DetlevD @ Dec 9 2015, 17:45) \<{POST\_SNAPBACK}\>

I assume you want to access an external file given by the URL and store a copy as a local file.

From within different Windows applications it is possible to load or access files by an URL.  
Also ... executing an URL string at the CMD processor command line or at the Explorer address line, will download the named URL object and will start some application, which is on your system responsible for the given file type ... for example ... executing the following URL on the commandline will start your standard graphic application and will load the file given by the URL.

```
URL Examples ... 
http://forums.mp3tag.de/uploads/av-11458.png
http://forums.mp3tag.de/uploads/av-3194.png
http://forums.mp3tag.de/style_emoticons/default/huh.gif

```

Unfortunately this does not work in Mp3tag in the formatstring dialog of the action "Import cover from file".  
And I assume, that referencing a tag-field with a stored URL will also not work.  
At least it does not work for me with Mp3tag v2.72b on Win XP.

So you may create and apply an Mp3tag export script, which exports the content of the tagfield, i. e. the stored URL, into a self made "bat" or "cmd" command file or such, and let retrieve and store the image file with the given URL, by executing some graphical exe application (e. g. Irfanview.exe, convert.exe from ImageMagick or whatever else).

DD.20151209.1802.CET

Thank you very much!

I ended up making an export that created a .bat containing a simple powershell script:

$filename(x:\mp3tag\scripts\downloadimage.bat,utf-8)cmd  
powershell -command "& { iwr %coverlink% -OutFile %\_folderpath%%albumartist% - %album%.jpg }"

Then I added "downloadimage.bat" as a tool, so after I have run my actions, I double click on any mp3 and the script runs.

Seems to work fine and the easiest way I could think of. Look ok to you? 🙂

---

<div class="post-metadata">

**Author:** ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)\
**Post date:** [December 9, 2015, 7:19pm UTC](https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442/4 "2015-12-09T19:19:16Z")

</div>

> [@KrissO](#):
>
> ...I ended up making an export that created a .bat containing a simple powershell script...

It is possible to construct an Mp3tag tool to download a file, given its URL, without exporting to a bat file.  
(see: [http://superuser.com/questions/59465/is-it...ws-command-line](http://superuser.com/questions/59465/is-it-possible-to-download-using-the-windows-command-line))

For example:

```
Name: File Downloader
Path: C:\Windows\System32\cmd.exe
Parameter: /K powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"%URL%\", \"%_folderpath%FILE_NAME.$regexp(%URL%,(.+\.)(.+),$2)\")"

```

- /K keeps the command window open after the command is executed. Replace it with /C to close the window after execution.
- %URL% is the placeholder for whichever field is used to store the URL (eg. %coverlink%).
- FILE\_NAME could be any valid string or derived from some other field (eg. %albumartist% - %album%).
- %\_folderpath% causes the downloaded file to be placed in the folder of the selected file. Any other **existing** folder could be used.
- The $regexp function obtains the file extension by assuming the extension is the characters following the last dot in the URL.

An existing file with the same path will be overwritten without warning.

---

<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:** [December 9, 2015, 8:02pm UTC](https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442/5 "2015-12-09T20:02:37Z")

</div>

> [@KrissO](#):
>
> ... Then I added "downloadimage.bat" as a tool, so after I have run my actions, I double click on any mp3 and the script runs. ...

Your answer let assume that you know what you are doing, that's fine, and ... additionally to the extended proposal from user "ryerman" I want to point you to the commandline tool ... WGET.  
You can call WGET.EXE within a Mp3tag Tool dialog.  
This seems to be the straightest way to get a file from the internet.

Example:  
Name: WGET coverlink  
Path: \WGET\bin\wget.exe  
Parameter: %coverlink%

[http://gnuwin32.sourceforge.net/packages/wget.htm](http://gnuwin32.sourceforge.net/packages/wget.htm)  
[https://www.gnu.org/software/wget/](https://www.gnu.org/software/wget/)  
[http://wget.addictivecode.org/](http://wget.addictivecode.org/)  
[https://www.gnu.org/software/wget/manual/ht...ownload-Options](https://www.gnu.org/software/wget/manual/html_node/Download-Options.html#Download-Options)  
[https://www.gnu.org/software/wget/manual/ht...ml#Simple-Usage](https://www.gnu.org/software/wget/manual/html_node/Simple-Usage.html#Simple-Usage)  
[http://www.delorie.com/gnu/docs/wget/wget\_toc.html](http://www.delorie.com/gnu/docs/wget/wget_toc.html)

DD.20151209.2202.CET

---

<div class="post-metadata">

**Author:** ![KrissO](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/96bed5/32.png) [@KrissO](https://community.mp3tag.de/u/KrissO)\
**Post date:** [December 9, 2015, 10:11pm UTC](https://community.mp3tag.de/t/export-image-from-url-in-custom-field/17442/6 "2015-12-09T22:11:26Z")

</div>

> [@DetlevD](#):
>
> Your answer let assume that you know what you are doing, that's fine, and ... additionally to the extended proposal from user "ryerman" I want to point you to the commandline tool ... WGET.  
> You can call WGET.EXE within a Mp3tag Tool dialog.  
> This seems to be the straightest way to get a file from the internet.
> 
> Example:  
> Name: WGET coverlink  
> Path: \WGET\bin\wget.exe  
> Parameter: %coverlink%
> 
> [http://gnuwin32.sourceforge.net/packages/wget.htm](http://gnuwin32.sourceforge.net/packages/wget.htm)  
> [https://www.gnu.org/software/wget/](https://www.gnu.org/software/wget/)  
> [http://wget.addictivecode.org/](http://wget.addictivecode.org/)  
> [https://www.gnu.org/software/wget/manual/ht...ownload-Options](https://www.gnu.org/software/wget/manual/html_node/Download-Options.html#Download-Options)  
> [http://www.delorie.com/gnu/docs/wget/wget\_toc.html](http://www.delorie.com/gnu/docs/wget/wget_toc.html)
> 
> DD.20151209.2202.CET

That works just as well, thanks!

QUOTE (ryerman @ Dec 9 2015, 21:19) \<{POST\_SNAPBACK}\>

It is possible to construct an Mp3tag tool to download a file, given its URL, without exporting to a bat file.

(see: [http://superuser.com/questions/59465/is-it...ws-command-line](http://superuser.com/questions/59465/is-it-possible-to-download-using-the-windows-command-line))

For example:

```
Name: File Downloader
Path: C:\Windows\System32\cmd.exe
Parameter: /K powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"%URL%\", \"%_folderpath%FILE_NAME.$regexp(%URL%,(.+\.)(.+),$2)\")"

```

- /K keeps the command window open after the command is executed. Replace it with /C to close the window after execution.
- %URL% is the placeholder for whichever field is used to store the URL (eg. %coverlink%).
- FILE\_NAME could be any valid string or derived from some other field (eg. %albumartist% - %album%).
- %\_folderpath% causes the downloaded file to be placed in the folder of the selected file. Any other **existing** folder could be used.
- The $regexp function obtains the file extension by assuming the extension is the characters following the last dot in the URL.

An existing file with the same path will be overwritten without warning.

Thank you very much!
