I know this is an ancient post but I felt that I needed to add this here.
I stumbled with the examples given for a little while, but eventually worked out the best way use just a batch to create the proper ICO from a 512x512 transparent PNG.
This code is the beginning to a "MULTI9" drag'n'drop script that I frequently write for Windows.
Windows will only accept 9 files dragged onto a .bat at once due to the way the number macros work.
%~dpnx (Drive Path Name eXtension) numbers only go to 9, and using "10" and above will not have the effect you need.
This works on all versions of Windows, but you will have to
change the IMDIR location to suit your install location.
Copy and paste this code into a new .bat, and then drag 'n drop a 512x512 PNG onto it, and it will create a proper full 256x256 multi-paged ICO.
Code: Select all
@ECHO OFF
REM ---------------------------------
REM Script by Jenkins
REM ©1996-2016 Jenkins Media
REM ---------------------------------
@SETLOCAL enableextensions
@CD /d "%~dp0"
SET IMDIR=C:\Program Files\ImageMagick-6.8.7-Q16
PUSHD "%~dp0"
"%IMDIR%\%APP%" "%~dpnx1" -resize 256x256 "%~dpn1-256.png"
"%IMDIR%\%APP%" "%~dpnx1" -resize 128x128 "%~dpn1-128.png"
"%IMDIR%\%APP%" "%~dpnx1" -resize 96x96 "%~dpn1-96.png"
"%IMDIR%\%APP%" "%~dpnx1" -resize 64x64 "%~dpn1-64.png"
"%IMDIR%\%APP%" "%~dpnx1" -resize 48x48 "%~dpn1-48.png"
"%IMDIR%\%APP%" "%~dpnx1" -resize 32x32 "%~dpn1-32.png"
"%IMDIR%\%APP%" "%~dpnx1" -resize 16x16 "%~dpn1-16.png"
"%IMDIR%\%APP%" "%~dpn1-256.png" "%~dpn1-128.png" "%~dpn1-96.png" "%~dpn1-64.png" "%~dpn1-48.png" "%~dpn1-32.png" "%~dpn1-16.png" "%~dpn1.ico"
POPD
ECHO DONE!
TITLE DONE!
ECHO.
PAUSE
EXIT
I noticed that the biggest problem was the
order in which the size files come for the
convert to ICO command.
On this thread, and the IM Examples site gives you "
lowest to highest" increasing file dimensions as the order to convert with...
This didn't work for me, and I had to reverse the order to be "
highest to lowest" and after which the proper large transparent ICO was created (instead of it being 16x16)
This script also means you do not need to resize the icons manually, and includes the Apple retina sizes (96x96, 48x48) and the 256x256 "PNG" layer for very large icons in Windows/OSX.
If you don't want to keep the "resized" versions of the PNGs, add this
before the
POPD line;
Code: Select all
DEL "%~dpn1-256.png"
DEL "%~dpn1-128.png"
DEL "%~dpn1-96.png"
DEL "%~dpn1-64.png"
DEL "%~dpn1-48.png"
DEL "%~dpn1-32.png"
DEL "%~dpn1-16.png"
Hope this helps anyone looking to achieve this with some level of automation
-Jenkins