ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

How can I batch decompile icon files?

<< < (2/3) > >>

vlastimil:
Here is a script for Mouser that cleans up icons. To use it, go to the Batch pate in RWIconEditor, select "Custom operation #1" or #2 in the "Batch operation" combo-box, then click on Load button and select the file attached to this post after unzipping it.

Then drag and drop icons on the window. As soon as you do that, a window will pop-up, where you can select what sizes and color depths to keep in the .ico file. All other images will be deleted. The result will then be accessible in the lower part of the window. The window will appear each time something is dropped on the application window - if you want multiple icons processed at once, drag and drop them together or drag and drop a folder.

There is a bit of JavaScript in the operation that you can access using the "Configure" button, but unfortunately it does not work correctly on 64-bit editions of Windows (the window nesting depth problem), so don't touch that if you are on 64-bit OS.

Modifying the script to also create images if they are not present in the .ico would not be too hard, but since kunkel321 asked for a free solution, I will not do that right now and get back to playing XCOM  :-*

kunkel321:
Thanks Everyone, for the excellent recommendations!

For those who don't know the connection, Vlastimil is the creator of RW Icon Editor (referenced by Curt, above).
As it turns out...  A couple years ago Vlastimil was feeling particularly generous and donated several copies of his Icon Editor here on the DC forums. . . . And I was one of the lucky recipients!  I put several hours into it back then, but got overwhelmed because it is such a powerful tool that it blew my mind a bit, so I haven't even looked at it in quite a long time.  So again, the solution was right under my nose!  I did try the Clean-up icon script as explained above and it works like a charm!  Thanks so much!  Is this something you just scripted?  Modifying the script to make conversions for missing sizes would be awesome!  I'd recommend only converting down though.  For example a 64x64 could be used to make a 32x32, but not a 128x128.  It would need to check each individual ICO to see if there are any of the defined sizes missing.  Obviously writing-over an existing image wouldn’t be desirable. 

Note that if an ICO contains only low-bit images, RW will save the empty icon file just the same (as one would expect).  One of my file managers choked on the empties, but the other two file managers didn’t have a problem.   For a supplemental script like this, it probably doesn’t matter, but if you integrate this “icon cleaning” into the main application you might want to have an info message popup about it. 

===
I also checked out the “Icons from File” tool from vlsoftware.  It’s pretty cool.  I really like the way it can locate resources that contain icons and filter out ones that have <n icons.  This makes it unique.  The problem is that when you save the extracted items as icons, Icons from File only seems to save the 32x32, and none of the other sizes…  The help file does say that it doesn’t change the icons in any way when it extracts them…  Maybe it’s just a bug in my system—I don’t know.

===
Unfortunately I don’t have a Linux machine…
Vlastimil’s solution seems to be the one that does what I was wanting.
Thanks again everyone!

vlastimil:
Oh, since you already have the software, here is an updated version of the script. Now it not only deletes extra images, but also create missing images. When creating new image, the source image is the one with the highest color depth and the biggest size, with one exception. If there is an image, that is exactly 2x, 3x, or 4x larger, it is selected as a source image. So for example, if an icon contains 32x32 and 48x48 images and you want it to also have 16x16 and 24x24 images, the 16x16 is created from the 32x32 one and the 24x24 from the 48x48. Image quality tends to be better when the scaling factor is a small integral number.

kunkel321:
I just wanted to log on to this thread and say, "Thanks again!" to Vlastimil.
The "Normalize icon" script works beautifully!  Good thinking with the point about scaling from images who's dimensions are a multiple of the to-be-made images.  

I've been putting some time into reacquainting myself with Real World Icon Editor.  It's a pretty amazing application, and an incredibly versatile tool for icon creation.  I have some questions about setting up batch jobs and also some questions about Unicorn work....  Do you find it easier to discuss these topics as threads here at  the DonCod forums, or over at the RealWorld forums though?

Edit:  Actually...  One more question that is relevant to this particular thread:
Is it difficult to set the Normalize script to only scale down? 
What I mean is that I'd still specify the desired icon sizes, but missing sizes would only get created from larger ones... 

I thought I'd be clever an suggest how the logic might work...  Mostly it just hurts my brain.





mouser:
Very very very nice.  :up:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version