Skip Ribbon Commands
Skip to main content

Title

Save album cover data as files

Body

I put the below script together to save the medial album cover data as separate files.

#Easy way to install taglib-sharp.dll
#Installs module from PowerShell Gallery https://www.powershellgallery.com/packages/ID3/1.1 Easily Gets you taglib-sharp.dll if you don't have it.
Install-Module -Name ID3

#Import taglib-sharp.dll for use
Import-Module "C:\Program Files\WindowsPowerShell\Modules\ID3\1.1\taglib-sharp.dll"


#Insert the file path of your media file between the ""
$FilePath = (-Childitem -Path "" | Select-Object -Property FullName, BaseName, DirectoryName)

#Variablize media file data
$FileID3Tag = [taglib.file]::create($FilePath.FullName)

#Counter for do while, covers if media file has more than one image file embedded
$Mp3ImageCounter = 0

DO{

#Variablize media file image type
$ImageFileType = $FileID3Tag.Tag.Pictures[$Mp3ImageCounter].MimeType.TrimStart("image/")

#Variablize media file image data
$ImageFileData = $FileID3Tag.Tag.Pictures[$Mp3ImageCounter].Data

#Takes the image data from the media file and saves it to the directory of the media file with the same base name but the image file type procured from media file
$ImageFileData | set-content -Path ($FilePath.DirectoryName+"\"+$FilePath.BaseName+"."+$ImageFileType) -Encoding  byte

#Increases counter
$Mp3ImageCounter++

#($FileID3Tag.Tag.Pictures.Count-1) remove 1 from the number of embedded files as array starts with 0`
}While ($Mp3ImageCounter -le ($FileID3Tag.Tag.Pictures.Count-1))

Today's date

10/3/2018

Twitter

 
Approval Status Pending
 

Attachments

Created at 10/3/2018 11:15 AM by  
Last modified at 10/3/2018 11:15 AM by