Created
February 8, 2024 04:10
-
-
Save yell0wsuit/2708ae67da16bf4aa6db53e227a604ac to your computer and use it in GitHub Desktop.
Generate favicon for website on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
set IMAGE=favicon.png | |
set OUTPUT=favicon.ico | |
set SIZES=16 32 64 128 192 256 | |
:: Create a temporary directory for resized images | |
set TEMP_DIR=%~dp0temp_ico | |
mkdir "!TEMP_DIR!" | |
:: Resize the image to each size and save temporarily | |
for %%s in (%SIZES%) do ( | |
magick "!IMAGE!" -resize %%sx%%s "!TEMP_DIR!\%%s.png" | |
) | |
:: Combine all resized images into a single ICO file | |
magick "!TEMP_DIR!\*.png" "!OUTPUT!" | |
:: Clean up the temporary directory | |
rd /s /q "!TEMP_DIR!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment