how do I make a multi resolution .ico file?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
agent.coulson
Posts: 4
Joined: 2016-05-09T06:02:52-07:00
Authentication code: 1151

Re: how do I make a multi resolution .ico file?

Post by agent.coulson »

thanks, now with this command

Code: Select all

magick "%~1" -resize 256x256 -gravity center -extent 256x256 -define icon:auto-resize="256,128,96,64,48,32,16" "%~n1.ico"
i get this http://uptobox.com/0x6umc2kj8wd

Image

how to make the white color to tranparent?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how do I make a multi resolution .ico file?

Post by fmw42 »

Code: Select all

magick "%~1" -resize 256x256 -gravity center -background none -extent 256x256 -define icon:auto-resize="256,128,96,64,48,32,16" "%~n1.ico"
agent.coulson
Posts: 4
Joined: 2016-05-09T06:02:52-07:00
Authentication code: 1151

Re: how do I make a multi resolution .ico file?

Post by agent.coulson »

thanks.. :D
Froschkoenig84
Posts: 1
Joined: 2019-06-06T20:17:23-07:00
Authentication code: 1152

Re: how do I make a multi resolution .ico file?

Post by Froschkoenig84 »

Windows batch file, which creates multiple sized .PNGs and merge them to one .ICO file:

Code: Select all

@echo off

set inkScape="C:\SOFTWARE\GRAPHIC\INKSCAPE\inkscape.exe"
set imageMagick="C:\SOFTWARE\DEVELOPER\IMAGEMAGICK\magick.exe"
set fileName=favicon
set importType=svg
set exportType=png
set exportDpi=300
set imageSizes=(16 24 32 48 57 60 64 70 72 76 96 114 120 128 144 150 152 180 192 196 256 300 320 400 450 460 480 512 600)

for %%s in %imageSizes% do (
 %inkScape% -z -f %~dp0%fileName%.%importType% -w %%s -h %%s -e %~dp0%fileName%-%%sx%%s.%exportType% -d %exportDpi%
 echo CREATED: %fileName%-%%sx%%s.%exportType%
 set e=%fileName%-%%sx%%s.%exportType%
 call :concat (e)
)

%imageMagick% %exportFileNames%"%~dp0%fileName%.ico"
echo MERGED IN: %fileName%.ico

pause goto :eof


:concat (e) (
 set exportFileNames=%exportFileNames%"%~dp0%e%" 
)
If you don't need the .PNG files, you can delete (or remove) them by...

Code: Select all

del FILE
...or you save all PNGs inside a directory you can remove after...

Code: Select all

%imageMagick% %exportFileNames%"%~dp0%fileName%.ico"
Hope it helps somebody. :)
Post Reply