how do I make a multi resolution .ico file?
how do I make a multi resolution .ico file?
I have IM installed, (used it in an app) but I still like using the web "Studio" pages for conversion sometimes.
I have used the Studio to convert a 256 pixel PNG into an ICO with transparency
put its only 256. ICOs can (should) be multi-resolution 16, 32, 64, 128 AND 256 pixels sqaure.
can IM (studio or otherwise) do this?
(all of my other ICO tools are based on 24 bit BMPs and do't do alpha, and now you NEED alpha icons in vista!)
tia
I have used the Studio to convert a 256 pixel PNG into an ICO with transparency
put its only 256. ICOs can (should) be multi-resolution 16, 32, 64, 128 AND 256 pixels sqaure.
can IM (studio or otherwise) do this?
(all of my other ICO tools are based on 24 bit BMPs and do't do alpha, and now you NEED alpha icons in vista!)
tia
Re: how do I make a multi resolution .ico file?
Create all the different sizes you require and write them to the ICO file. Something like:
convert icon-32.bmp icon-64.bmp icon-128.bmp icon-256.bmp myicon.ico
convert icon-32.bmp icon-64.bmp icon-128.bmp icon-256.bmp myicon.ico
Re: how do I make a multi resolution .ico file?
To reduce the file size, try "-colors 256" and see how it looks:
convert icon-32.bmp icon-64.bmp icon-128.bmp icon-256.bmp -colors 256 myicon.ico
Note, -depth does not reduce the file size.
More keywords to make this thread easier to find: favicon page multipage (the frames are called "pages") multisize multiresolution 16x16 32x32 48x48 64x64 256x256.
convert icon-32.bmp icon-64.bmp icon-128.bmp icon-256.bmp -colors 256 myicon.ico
Note, -depth does not reduce the file size.
More keywords to make this thread easier to find: favicon page multipage (the frames are called "pages") multisize multiresolution 16x16 32x32 48x48 64x64 256x256.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: how do I make a multi resolution .ico file?
This information has now been added to IM examples, Thumbnails
http://www.imagemagick.org/Usage/thumbnails/#favicon
(It should appear in an hour or so)
http://www.imagemagick.org/Usage/thumbnails/#favicon
(It should appear in an hour or so)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: how do I make a multi resolution .ico file?
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.
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;
Hope this helps anyone looking to achieve this with some level of automation
-Jenkins
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
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"
-Jenkins
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: how do I make a multi resolution .ico file?
Using "IM 6.9.2-8 Q16 x64" or "IM 7.0.0-0 Q16 x64 2016-01-09" and Windows 7 Pro 64, this can be done with a batch file like this without creating the intermediate files...Jenkins wrote:Hope this helps anyone looking to achieve this with some level of automation
Code: Select all
@echo off
setlocal
set IMDIR=c:\Program Files\ImageMagick
pushd "%~dp1"
"%IMDIR%\convert" "%~1" -define icon:auto-resize="256,128,96,64,48,32,16" "%~n1.ico"
popd
@echo Done!
pause
exit
Re: how do I make a multi resolution .ico file?
Awesome! Never knew about the -define param, thanks!GeeMack wrote:Using "IM 6.9.2-8 Q16 x64" or "IM 7.0.0-0 Q16 x64 2016-01-09" and Windows 7 Pro 64, this can be done with a batch file like this without creating the intermediate files...Jenkins wrote:Hope this helps anyone looking to achieve this with some level of automation
Use pushd "%~dp1" to create the new icon in the directory where the original PNG image resides. Edit that to pushd "%~dp0" if you want to create the icon in the directory where the script resides. It will probably work with almost any version of Windows that anyone is still using, and almost any recent or near future version of IM.Code: Select all
@echo off setlocal set IMDIR=c:\Program Files\ImageMagick pushd "%~dp1" "%IMDIR%\convert" "%~1" -define icon:auto-resize="256,128,96,64,48,32,16" "%~n1.ico" popd @echo Done! pause exit
But with your
set IMDIR=c:\Program Files\ImageMagick
Unfortunately as you know IM doesn't install to a folder without a version number. It always has had the version and the (quantum?) depth in the title.
I wrote a rigorous way around this last year, but it slows the scripts right down. Instead I find it easier to update all my scripts at once after I install a new version of IM...
Code: Select all
REM = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
REM = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
REM # # Let's begin # #
REM = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
REM = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
REM We need to dynamically find mogrify.exe and use it's location as a variable
REM This will future proof this converter so long as IM don't change the name of "mogrify.exe"
REM We also need to check what architecture the user has, and where abouts IM is installed.
REM -------------------------------------------------------------
REM Rigorous check for mogrify.
REM Search for mogrify in the progfiles W6432 Tree (The x64 C:\Program Files\ folder on a 64bit machine)
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (GOTO X64) ELSE GOTO X86
REM Take the highway to the danger zone [we didn't detect any architecture]
GOTO ARCHERR
:X86
ECHO Windows 32bit detected
SET PF=%ProgramFiles%
GOTO CONT1
:X64
ECHO Windows 64bit detected
ECHO(
SET PF64=%ProgramFiles(x86)%
SET PF=%ProgramW6432%
GOTO CONT1
:CONT1
REM Check that mogrify exists at all.
REM NOTE the second SET and the IF statement nested in the FOR loop.
REM We're assuming that the user has installed the 32bit version of IM on their 32bit machine, and 64bit IM on their 64bit machine, duh
REM Push into the current directory and start the FOR loop
REM then check IF the name is equal to "mogrify.exe"
REM Finally if one is found, SET MOGEXIST to TRUE, grab it's directory and SET it as IMDIR and GOTO CONT2, the next step, breaking out of the loop
ECHO Searching for mogrify.exe in %PF% . . .
ECHO(
PUSHD "%PF%" &&(
FOR /R "." %%i IN (*.exe) DO (
IF /i "%%~nxi"=="mogrify.exe" (
SET MOGEXIST=TRUE
SET IMDIR=%%~dpi
GOTO:CONT2
)
)
)
REM Old SET
REM SET IMDIR=C:\Program Files\ImageMagick-6.8.7-Q16
REM Flowed from mogrify check loop, this means we didn't find her
GOTO NOMOG
:CONT2
REM Now broken out of mogrify check loop, pop back out of %PFFolder%
POPD
REM MOGEXIST will only be defined if mogrify.exe is found in a sub folder of %PFFolder% (aka %PF% aka %ProgramFiles%).
REM Otherwise, it will skip our next SETMOG function and goto NOMOG error block
If Defined MOGEXIST (GOTO SETMOG) else (
GOTO NOMOG)
REM -------------------------------------------------------------
:SETMOG
REM -------------------------------------------------------------
REM This Is where the rest of the script goes
--trimmed--
I've read other ways to achieve this too, such as pulling values from the registry and SETting them for the location, but I went with the pure FOR loop instead.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how do I make a multi resolution .ico file?
That's the default behaviour. But one of the installation screens lets you change the directory.Jenkins wrote:Unfortunately as you know IM doesn't install to a folder without a version number. It always has had the version and the (quantum?) depth in the title.
I use too many versions and varieties for that "find mogrify.exe" script to help, but it's a good idea. My scripts generally use %IM% or %IMDEV% as the directories for pre-compiled or DIY binaries.
snibgo's IM pages: im.snibgo.com
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: how do I make a multi resolution .ico file?
I keep two working versions of ImageMagick on my Windows 7 64 machine, the current Windows binary release version 6.X.X-X Q16 x64 static, and the current Windows binary beta version 7.X.X-X Q16 x64 static. They're installed in "c:\Program Files\ImageMagick" and "c:\Program Files\ImageMagick7" respectively. I specify the install directories when I update. I don't know if the setup programs do something different for the DLL versions.Jenkins wrote:I wrote a rigorous way around this last year, but it slows the scripts right down. Instead I find it easier to update all my scripts at once after I install a new version of IM...
I have both directories in my PATH, the IM6 first, so if I call "convert" from the command line it uses version 6, and if I call it by "magick" it uses version 7. In my scripts I don't even specify a full path, just "convert" or "magick". I mostly use IM from Windows batch files and command line, but sometimes I use the *nix command line from Cygwin (under Windows). I haven't even installed a *nix version of ImageMagick. Cygwin inherits the Windows path and IM just works in a command window. If it's accidentally easier for me than for other people I'm not going to complain.
Re: how do I make a multi resolution .ico file?
Not a bad idea! The only reason I tried to accomplish it that way was so that it would work on any IM install, no matter where it is installed to (but so long as it's in Program Files). Using PATH variables is also a good idea but I have come across issues in the past where the PATH string has been corrupted by software that incorrectly added entries to it containing invalid chars. I have almost 1TB of software on my main design computer, and about 30-40% of that software adds entries to PATH.snibgo wrote:That's the default behaviour. But one of the installation screens lets you change the directory.Jenkins wrote:Unfortunately as you know IM doesn't install to a folder without a version number. It always has had the version and the (quantum?) depth in the title.
I use too many versions and varieties for that "find mogrify.exe" script to help, but it's a good idea. My scripts generally use %IM% or %IMDEV% as the directories for pre-compiled or DIY binaries.
I don't think they are different, but from memory (it's been a while since I used the DLL versions) it adds the "-DLL" to the end of the folder name, e.g 6.7.8.9-Q16-DLLGeeMack wrote:I keep two working versions of ImageMagick on my Windows 7 64 machine, the current Windows binary release version 6.X.X-X Q16 x64 static, and the current Windows binary beta version 7.X.X-X Q16 x64 static. They're installed in "c:\Program Files\ImageMagick" and "c:\Program Files\ImageMagick7" respectively. I specify the install directories when I update. I don't know if the setup programs do something different for the DLL versions.Jenkins wrote:I wrote a rigorous way around this last year, but it slows the scripts right down. Instead I find it easier to update all my scripts at once after I install a new version of IM...
-
- Posts: 4
- Joined: 2016-05-09T06:02:52-07:00
- Authentication code: 1151
Re: how do I make a multi resolution .ico file?
Jenkins wrote:I know this is an ancient post but I felt that I needed to add this here.
Hope this helps anyone looking to achieve this with some level of automation
-Jenkins
hi dude, thanks for sharing, really helpfullGeeMack wrote:It will probably work with almost any version of Windows that anyone is still using, and almost any recent or near future version of IM.
but 1 question, how to create icon without streched, i mean look this image
thanks, sorry bad english
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how do I make a multi resolution .ico file?
You should put the actual files online (not screenshots) and the command(s) you used, and say what version of IM you use, on what platform.
snibgo's IM pages: im.snibgo.com
-
- Posts: 4
- Joined: 2016-05-09T06:02:52-07:00
- Authentication code: 1151
Re: how do I make a multi resolution .ico file?
this my imagesnibgo wrote:You should put the actual files online (not screenshots) and the command(s) you used, and say what version of IM you use, on what platform.
then convert to .ico with this command
Code: Select all
magick "%~1" -define icon:auto-resize="256,128,96,64,48,32,16" "%~n1.ico"
i using the latest update, thanks
Win10
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how do I make a multi resolution .ico file?
The documentation http://www.imagemagick.org/script/comma ... s.php#draw says:
I suggest you "-resize", perhaps also "-extent", to make it 256x256.icon:auto-resize : Automatically stores multiple sizes when writing an ico image (requires a 256x256 input image).
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: how do I make a multi resolution .ico file?
To extend look at IM Examples, Thumbnails, Square Padding or Cropping
http://www.imagemagick.org/Usage/thumbnails/#square
Of course as you have a specific size (or sizes) you have other options
http://www.imagemagick.org/Usage/thumbn ... it_summery
http://www.imagemagick.org/Usage/thumbnails/#square
Of course as you have a specific size (or sizes) you have other options
http://www.imagemagick.org/Usage/thumbn ... it_summery
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/