• AnyStream is having some DRM issues currently, Netflix is not available in HD for the time being.
    Situations like this will always happen with AnyStream: streaming providers are continuously improving their countermeasures while we try to catch up, it's an ongoing cat-and-mouse game. Please be patient and don't flood our support or forum with requests, we are working on it 24/7 to get it resolved. Thank you.

Custom Icons For Movie Folders (Batch Convert PNG to ICO And Then Some)

zanetti

Well-Known Member
Thread Starter
Joined
Apr 6, 2021
Messages
676
Likes
323
so, im getting low on HDD space and what does hoarder's OCD do when low on HDD space? easy. find a new tedious, time consuming task to feed the OCD while waiting for more HDD space.

so, i thunk. i thunk hard and had a bright idea. 'So bright you have to wonder why ain't nobody never thought about it before!'. you know, i said to my OCD, that one time every 17 months when i have to access the HTPC from another computer via SMB in that other computer's windows explorer? well, i thunk'd, wouldn't it be neat if when i opened one of the movies folder on my HTPC i get a bunch of beautiful movie posters for each movie folder instead of those bleh windows' yellow ones? OCD is intrigued, i can feel it. no time to waste. internet search. mmhm. ok, clearlogo PNGs (movie posters don't work since they are too small when ICOniz'd, pro tip btw) to ICOs. et voila. found a few freeware programs, one can even output the ICO file to the same folder clearlogo PNG came from, neat! oh, wait. what? why is the aspect ratio of the ICO file all messed up if i set explorer view to anything but 'list' or 'small icons'?? 256x256? like, a box? every size is a box?? well, that is idiotic.

long story short (we are getting there, be patient with my TED talk, thank you), after a few hours of tinkering, installing, trying, deinstalling and (god forbid) almost giving up on this obviously stupid, tedious, uneccessary task i've put before me, i have come up with a solution that needs some polishing. hear me out.

went and bought folderICO (20$). it can change your folder icon and not only that. you can turn any pic into an icon and the program saves it in that folder along with a tiny .ini file. and, here is the kicker, the aspect ratio of such ICO is correct. so, a win, right? not so much. i have to (insert sympathy, compassion, understanding and empathy for this problem i am facing, dear fellow nerd... pardon, 'moving pictures enthusiast/collector') do everything movie by movie. having a few thousand of those, even my OCD is having second thoughts.

time for another bright idea. what if i do a search for all clearlogo PNGs in my movie folder, copy them to another folder and then import them into folderICO as a new (icon) library (yeah, you can do that, btw)? ooooh, nooo. it works, but it renames all the PNGs (e.g. black.hawk.down-clearlogo.png to black72638.ico). besides, folderICO's window is so small and it can not be resized. arrrgh, die 4K, die! why is everything so tiny even with 275% scaling, arrrggh???

ok. f it. one by one it is. add folder. enter. add image (manually or scroll through folderICO's tiny window to find ICO from the imported library). enter. apply. enter. clear folder. enter. add folder. scroll. enter. add image. scroll. enter. apply. yeah, i can't add 10 folders, add 10 images (each for respective folder) and do 10 or more at a time. one. by. one. even my OCD is now having serious second, third and fourth thoughts.

so, here i am. a simple man. asking for some help. how can one speed up this process? i'm ready for anything, but hear my idea of what the perfect solution would be: batch it. everything. and i do mean every. thing.

  1. - clearlogo PNGs to ICOs with correct aspect ratio (ok, folderICO does that, nevermind the renaming issue although that might become important, not sure as of yet).
  2. - creating .ini files for each ICO.
  3. - placing every single ICO and corresponding INI to each folder (from where each clearlogo PNG came from).
  4. - applying those ICO and INI files to windows explorer (changing customize/foldericons option - maybe it is just a simple F5 in explorer, not sure).
ok, im aware that linking the destination of newly created ICOs to the source of clearlogo PNGs is not possible (or maybe it is), but is there at least a way to just copy all clearlogo PNGs into a single folder, then convert them to ICO (and INI) and then just (for lack of better and faster solution) open two explorer windows and ALT/TAB, CTRLC/CTRLV it? f it, that would be... let me crunch the numbers... a 15% increase in efficiency. i'll take it, lol.

anyways, thank you all for coming to my TED talk. any idea or suggestion are welcome. also, i'm attaching an example of how all this looks in windows explorer once done properly. planning on doing the same for TV series, although i'm sticking to scene type of naming so 10 seasons of x-files will all look the same, unless... unless i decide to create custom clearlogos for each season which, hahaha, is beyond idiotic and time consuming and won't be seen by no one, nor appreciated... oh well, the life of 'STANDARD NERDS', amirite?
 

Attachments

  • example.jpg
    example.jpg
    279.4 KB · Views: 11
Last edited:
  • Like
Reactions: DQ
bonjour,
sur Windows
tu a Toycon qui fait la meme chose , cerise sur le gateau , il est gratuit..

hello, on Windows you have Toycon which does the same thing, the icing on the cake, is free..
Translation
 
anyways, thank you all for coming to my TED talk. any idea or suggestion are welcome. also, i'm attaching an example of how all this looks in windows explorer once done properly. planning on doing the same for TV series, although i'm sticking to scene type of naming so 10 seasons of x-files will all look the same, unless... unless i decide to create custom clearlogos for each season which, hahaha, is beyond idiotic and time consuming and won't be seen by no one, nor appreciated... oh well, the life of 'STANDARD NERDS', amirite?

Ironically, I think that maneuver (as cool as it is) takes up more HD space :p

Also, someone needs to start a Content Nerd AA group. Although, that is basically what these forums are! :p
 
bonjour,
sur Windows
tu a Toycon qui fait la meme chose , cerise sur le gateau , il est gratuit..

eh, toycon would be perfect for an interim solution (drop all PNGs onto it and it creates ICOs with same filename, so i can just CTRLV them - although in my exprience id need an INI file as well, folder icon will not change if there is no INI file), but it only does 128x128 and smaller logos (like for movie 21) are too small, while the ones created by folderICO are nice and big and they are 256x256 (i dont think the overall size is what makes toycons ICO file so small, it looks like a resize thing). bummer. but, thanks!
 
Last edited:
Ironically, I think that maneuver (as cool as it is) takes up more HD space :p

true, true. and yeah, im not doing that. too much effort. besides, kodi doesnt display season logos at all, so... ill navigate by folder name in explorer. oh, did i mention i rarely use 'extra large' in explorer? only when i need to navigate thumbnails of stuff needed for crating logos (dvd covers, wallpapers, fanart etc)? yeah, another layer to the lunacy i involved myself in. 'i never use it, but ill spend months creating it'. now im looking into windows explorer alternatives with option to display even bigger than 'extra large' icons. im currently, as mentioned, at 4k and 275% scaling because TV is 10ft from the sofa, so anything smaller and it is just unusable. then i figured even if i can find such an alternative (that is usable and stable), i drop back to pure 4k without scaling, ill probably end up with huge icons and microscopic text lol. oh, well... anyways... back to the mine, me.
 
  • Like
Reactions: DQ
Uhm ... first thing, that popped into my mind to help (I don't really need it, because all the movies are in ONE folder which plex handles very well) ... isn't that something that's build into Windows already?
I mean, have a folder, throw a picture inside and have windows display it as folder icon (kind of)
Then I realized, if multiple mediafiles are inside that folder, Windows choses kind of random, which icon to display ... damn
So I read a lil more and found ... name the picture you want displayed "folder.jpg" and Windows grabs exactly that one as Folder picture.
Of course it looks like an open folder with that pic inside, but you won't need extra tools for that:
upload_2022-10-10_20-33-4.png

That sufficient? (I just used the disc labels, I had saved somewhere.)
 
So let my brain grasp your issue ...
You already have the ICO files, in one folder with (part of?) the movies name as filename?
You need to place them in the movie folder with the proper .ini file (how would that look like, btw?)
 
  • Like
Reactions: DQ
So let my brain grasp your issue ...
You already have the ICO files, in one folder with (part of?) the movies name as filename?
You need to place them in the movie folder with the proper .ini file (how would that look like, btw?)

sssssssssssshhhhhhhhhhhhhhhhh don't ask him questions he will just keep going on ... hahahahaahahah :)

I think most folks on this forum have this brand of OCD so you we are all in good company.
 
So let my brain grasp your issue ...
You already have the ICO files, in one folder with (part of?) the movies name as filename?
You need to place them in the movie folder with the proper .ini file (how would that look like, btw?)

well. all i have is a bunch of clearlogo PNGs. need to speed up the process of creating ICOs (with correct aspect ratio, meaning clearlogo PNG will not be stretched when converted to 256x256 ICO), INIs and then putting them into respective folders (preferably automatically IF there's such a thing: to link source folder(s) of PNG(s) to newly created ICO(s) and INI(s). also, it would be acceptable to just create ICOs and INIs but they should be named the same as (source) PNGs. folderICO creates ICOs from PNGs just fine aspect ratio wise and puts them in a separate folder, BUT the filenames are truncated and with a bunch of movie names' starting with 'the', i end up with tens of ICO files named 'the174628', 'the9982367' etc. folderICO, although good, is somewhat primitive e.g. no additional settings for file names, or (that would be great) to place generated ICOs (and INIs) into folders where PNGs came from, and its window is super small and non-resizable (bleh).

buuut, i made some progress (while adding another 140 movies one by one... 250 done, 20x to go yay!). found a similar program called 'MG folder icon pro'. it still lacks any additional options, BUT it has a (nonresizable, of course) explorer window inside its window (which can be full screened, yay). so, im now importing remaining PNGs into an ICO library in MGfolder and then going movie folder by movie folder in explorer portion of MGfolder and applying ICOs (and INIs, it creates both since you cant change folder icon in windows explorer without both, apparently).

i was hoping a nerd somewhere had already done all of this, and was hoping for some tips, maybe some super neat batch kung-fu tips etc. i love me a good batch, but cant code for turd, lol. recently i had to rename of bunch of files with gibberish file names but the folder names those files were placed in were correct, so i found this: @for /r /d %%x in (*) do @for %%y in (mkv avi mp4) do @ren "%%x\*.%%y" "%%~nxx.%%y" 2> NUL , and was hoping batch kung fu senseis could lend a hand with my little project. of course, if they already have it or something, i dont expect anyone taking their precious time batching for some nerd online for free, lol.

btw, heres an example how a done folder looks like: ICO and INI are hidden and marked as system files, which again i hid in explorer so the fact that they do not have the same name as movie (or PNG) dont really matter, but it would help if they did so i can ALTTAB->CTRLX/V them, one by one again of course, to respective movie folder(s).



anyways, thanks for reading my blog. cheers!
 

Attachments

  • example.jpg
    example.jpg
    107.9 KB · Views: 2
Last edited:
Well .. so far I put a script together that converts all png in a folder to ico ... problem is, the ico files are squared aspect ratio, stretching the non square clearlogos, which doesn't look good.
But thats just a matter of time until I figured out the converter ;)
Putting together some ini file should be trivial.
 
noooo, wait for me to finish this :eek:
But only tomorrow ... need some sleep :sleep:

hahaha, np. ill wait. ill go and create some custom posters instead. busy, busy, busy... anyways, yeah. aspect ratio can be done correctly, but i dont know anything about it lol. well, nighty night. sleep tight, get some rest. rest is important. and what im doing is important as well. and it will be even more important if you contribute some kung-fu batching. mhm. :thankyou:
 
Ok, done ...
But I don't do kung fu batching ... the mighty powershelling is my thing.
You need one (Freeware) tool: ImageMagick
Code:
https://imagemagick.org/script/download.php#windows
For smallest footprint use the portable edition.

When running the script with powershell (right click) you will be asked for your source folder (which will recursively searched for PNG files) and the imagemagick executable
CAREFUL: if you have multiple PNG files in one folder, only one (problably the last one, alphabetically) will be the ICO file
The script gets the image dimensions and whatever is bigger will be the new height and width, to make a square picture
Then follows the conversion to ICON, creation of the desktop.ini and hiding/systemizing of both files
Result looks like that:
upload_2022-10-11_12-26-0.png

One more question... is the ICO filename relevant for you? If so I need to make some adjustments and it might not work if there are blanks in it or other strange characters.
Currently all are named "folder.ico"

Uhh yea, one more thing ... after running the script the created files have the hidden and system flag, and cannot be overwritten so easily. So if you run the script a second time, both files are deleted first and then recreated.

Save as <somefilename>.ps1
Code:
Function Get-Folder($initialDirectory="")
{
  [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms")|Out-Null
  $foldername = New-Object System.Windows.Forms.FolderBrowserDialog
  $foldername.Description = "Select a source folder"
  $foldername.rootfolder = "MyComputer"
  $foldername.SelectedPath = $initialDirectory
  if($foldername.ShowDialog() -eq "OK")
  {
  $folder += $foldername.SelectedPath
  }
  return $folder
}

Function Get-FileName($initialDirectory="")
{  
   [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms")|Out-Null
   $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
   $OpenFileDialog.filter = "Imagemagick Executable (magick.exe)| magick.exe"
   $OpenFileDialog.ShowDialog() | Out-Null
   $OpenFileDialog.filename
}
#get folders and files from dialog
$source = Get-Folder
$magick = Get-FileName

#check for provided folder, then get all png images recursively
if($source){
   $list = Get-ChildItem $source -recurse *clearlogo.png -Force
} else {
   Write-Host "No valid source folder selected, cannot continue" -ForegroundColor red
   cmd /c pause
   Exit
}

#check for ImageMagick executable
if(-Not($magick)){
   Write-Host "No Imagemagick executable provided, cannot continue" -ForegroundColor red
   cmd /c pause
   Exit
}

#loop through found files
foreach ($file in $list){
   #get locations
   $fullpath=$file.fullname
   $path = (Split-path -Path $fullpath)
   $outputFile = $path + "\folder.ico"
   
   #get width and height of picture
   #whichever is higher will be the new height and width of the converted pic, to make it square
   Write-Host "Using $fullpath to convert to ICO"
   $widthcommand =  "$magick" + " identify -format "+ """%w""" + " "+ """$fullpath"""
   $width = (cmd /c "$widthcommand" 2`>`&1)
   $heightcommand =  "$magick" + " identify -format "+ """%h""" + " " + """$fullpath"""
   $height = (cmd /c "$heightcommand" 2`>`&1)
   $max = ($width,$height | Measure -Max).Maximum
   
   #check if ICO files already exists, if so -> delete
   #extend image to defined height and width filling with transparent background and create icon file
   if (Test-Path -Path $outputFile){
     Write-Host "File $outputFile exists, deleting..." -ForegroundColor Yellow
     Remove-Item "$outputFile" -Force
     $convert = "$magick" + " convert " + """$fullpath""" + " -background none -gravity center -extent " + $max + "x" + $max  + " -define icon:auto-resize=256 " + """$outputfile"""
     Write-Host "Creating $outputFile" -ForegroundColor Green
     cmd /c $convert
     Write-Host "Setting $outputFile hidden and System" -ForegroundColor Green
     (Get-ChildItem "$outputFile").attributes='System,Hidden'
   } else {
     $convert = "$magick" + " convert " + """$fullpath""" + " -background none -gravity center -extent " + $max + "x" + $max  + " -define icon:auto-resize=256 " + """$outputfile"""
     Write-Host "Creating $outputFile" -ForegroundColor Green
     cmd /c $convert
     Write-Host "Setting $outputFile hidden and System" -ForegroundColor Green
     (Get-ChildItem "$outputFile").attributes='System,Hidden'
   }     
   
   #check if INI file already exists, if so -> delete
   #create desktop.ini file pointing to ICO file
   $outIni = $path + "\desktop.ini"
   if (Test-Path -Path $outIni){
     Write-Host "File $outIni exists, deleting..." -ForegroundColor Yellow
     Remove-Item "$outIni" -Force
     Write-Host "Creating $outIni" -ForegroundColor Green
     "[.ShellClassInfo] `nIconFile=folder.ico `nIconIndex=0" > $outIni
     Write-Host "Setting Folder and $outIni hidden and System" -ForegroundColor Green
     (Get-ChildItem "$outIni").attributes='System,Hidden'
     (Get-Item "$path").attributes="System"
   } else {
     Write-Host "Creating $outIni" -ForegroundColor Green
     "[.ShellClassInfo] `nIconFile=folder.ico `nIconIndex=0" > $outIni
     Write-Host "Setting Folder and $outIni hidden and System" -ForegroundColor Green
     (Get-ChildItem "$outIni").attributes='System,Hidden'
     (Get-Item "$path").attributes="System"
   }     
   
}
cmd /c pause

There's for sure potential for optimizing the code and error catching, but for now it ran smoothly in my tests.

EDIT: Ok, next try ... it's just terrible if you have to mix Poswershell with command ... messes up the code
 
Last edited:
When running the script with powershell (right click) you will be asked for your source folder (which will recursively searched for PNG files) and the imagemagick executable
CAREFUL: if you have multiple PNG files in one folder, only one (problably the last one, alphabetically) will be the ICO file
The script gets the image dimensions and whatever is bigger will be the new height and width, to make a square picture
Then follows the conversion to ICON, creation of the desktop.ini and hiding/systemizing of both files

wow, thank you. just to recap: if i point the script to my movie folder will the script search for PNGs in that folder, that has hundreds of subfolders (which contain video files, JP(E)Gs and PNGs - only clearlogos are PNGs btw), convert PNGs to ICO+INI and name them 'folder.ico/ini'? OR should i copy all clearlogo PNGs from my movie folder to another folder and then point the script to that folder? i presume former, since every ICO and INI will be named 'folder.ico/ini', right?

ill give it a try on one movie folder and see how it goes. also, can i add a string or whatsitcalled to the script so instead of it searching for PNGs, it searches for 'clearlogo' (all my movies have a 'moviename-clearlogo.png' in their respective folder)? or even better, that it searches for '-clearlogo.png'? that way i dont have to worry if any of the thousands of movies have a poster or fanart in PNG format and script catches thosse instead of clearlogo (although even if that happens it should be easy to fix manually)?

also, goes without saying, script will not delete PNGs it finds, right? and one more thing. i noticed that if i manually create ICO and INI and place them into a movie's folder, folder icon doesnt change (even after F5ing it). i have to manually go into folder properties and change icon (bsomething both programs mentioned before do automatically after hitting apply). does this script take that into account as well? anyways, enough of me talking, off to trying this. thank you, much appreciated. cheers!

EDIT
ok, so ive copied 5 movies into a new test folder, ran the script, pointed it to that folder, pointed it to magick.exe, it runs but it errors out. it does create INI but no ICO. heres whats in red in PSHELL:

Get-ChildItem : Cannot find path 'D:\New folder
(3)\The.English.Patient.1996.1080p.WEB-DL.HEVC.x265.AC3.DD\folder.ico' because it does not exist.
At C:\Users\bubba\Desktop\script for foler icon.ps1:59 char:7

+ (Get-ChildItem "$outputFile").attributes='System,Hidden'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (D:\New folder (...3.DD\folder.ico:String) [Get-ChildItem], ItemNotFound
Exception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

The property 'attributes' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\bubba\Desktop\script for foler icon.ps1:59 char:6
+ (Get-ChildItem "$outputFile").attributes='System,Hidden'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: :)) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound


i bolded and underlined a single thing i found that might be a problem, the rest is chinese to me, lol. cheers!

EDIT2
ok, i had an idea to copy script to the test folder. i skipped pointing it to test folder as well as magick.exe and... it works! but, of course, discart is also PNG so i ended up with two hits and three misses, lol. which is a great start. so, either i need to modify the script to search for '-clearlogo.png' instead of only PNG or... ill delete thousands of discart PNGs (dont even use them, but artworkbeef addon in kodi grabs them nevertheless). anyways, it works!! YAY! thank you, thank you, thank you. i knew 'twas possible (but am too dumb to do it myself, lol). cheers!

EDIT3
ok, i tried changing line 28 to '$list = Get-ChildItem $source -recurse *clearlogo.png -Force', but that didnt work. then i noticed that the script actually works just fine (it catches the correct PNG and the ICO file is actually from clearlogo.png) BUT if i set explorer to 'extra large' 3/5 folders display discart.png as folder icon DESPITE the fact that ICO file is indeed from clearart.png (i triple checked, because i figured script grabs discart.png if there are both discart.png and clearlogo.png in the folder) AND folder properties says icon is the right one. if i switch to large, same thing, BUT if i switch to 'small icons'' then all folder icons automagically look correct. WTH? hahahaha, weird. HALP!
 
Last edited:
can i add a string or whatsitcalled to the script so instead of it searching for PNGs, it searches for 'clearlogo'
Sure ... replace
Code:
$list = Get-ChildItem $source -recurse *.png -Force
with
Code:
$list = Get-ChildItem $source -recurse *clearlogo.png -Force
also, goes without saying, script will not delete PNGs it finds, right?
No original files are deleted
i noticed that if i manually create ICO and INI and place them into a movie's folder, folder icon doesnt change (even after F5ing it)
Yeah, found that later, too ... the folder must have the "system" tag ... it's set in the script
Code:
(Get-Item "$path").attributes="System"
ok, so ive copied 5 movies into a new test folder, ran the script, pointed it to that folder, pointed it to magick.exe, it runs but it errors out. it does create INI but no ICO. heres whats in red in PSHELL
Lemme test that, will come back
 
Ok, I adjusted the search string to grab only files with "clearlogo.png" in it and added some more log
The other issue might be some caching thing, there are ways to clear the Windows Explorer cache
 
Ok, I adjusted the search string to grab only files with "clearlogo.png" in it and added some more log
The other issue might be some caching thing, there are ways to clear the Windows Explorer cache

ok, a small correction. actually the ICO files of those 3/5 were from discart. BUT they did change to correct ones with 'small icons' in explorer. lol. weird. i will try again with these changesand report back. cheers!

EDIT
ok, tried it. ICOs are correct, INIs are also created but they arent applied to folders. when i check folder properties the standard yellow folder icon is displayed (the v1 of script was applying the icon correctly it seems).

BUT the second time i went to folder properties icon was changed and if i go there and just hit OK the icon changes. hm. it seems script is lacking some sort of system refresh thingy or something (i also noticed with folderICO and MG that they refresh explorer every time i hit apply).

LOL of course, i CTRLX/CTRLV them back to movies folder and voila, icons are refreshed. they just dont refresh in the test folder no matter how many times i F5 them, hahahahaha. IT. WORKS! THANK YOU!!

LMFAO, i change from small to extra and some dont display icon change. AAARRGH! and, add insult to injury, ICO and INI are all kosher AND folder properties say icon is changed (and it displays changed icon)
hahahahahaha.

OK, last one from me, period. 'twas a thumbs.db issue. deleted those, icon is now refreshed and displayed properly. thank you. cheers!
 
Last edited:
As I said, that's some Icon cache from explorer... better reset that
Code:
C:\Users\%username%\AppData\Local\Microsoft\Windows\Explorer
Delete every iconcache* there
I did so and now the folder icon is displayed in every size
 
Back
Top