How to correctly resize a .ico file without blurring it

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?".
Post Reply
JoeShu95
Posts: 3
Joined: 2019-10-04T16:02:46-07:00
Authentication code: 1152

How to correctly resize a .ico file without blurring it

Post by JoeShu95 »

Hi there,

My application needs to resize .ico files, but it seems using the following command directly will blur the output to a great extent:

$ convert -resize 64x64 input.ico output.ico

I am using imagemagick on linux red hat 7. I searched all previous topics but didn't find anything related.

The sample image I used: http://www.iconarchive.com/download/i98 ... d/Xbox.ico

Thanks a lot!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to correctly resize a .ico file without blurring it

Post by fmw42 »

try

Code: Select all

convert input.ico -sample 64x64 output.ico
Proper syntax reads the input first.
JoeShu95
Posts: 3
Joined: 2019-10-04T16:02:46-07:00
Authentication code: 1152

Re: How to correctly resize a .ico file without blurring it

Post by JoeShu95 »

I tried, but it is still very blurry.
JoeShu95
Posts: 3
Joined: 2019-10-04T16:02:46-07:00
Authentication code: 1152

Re: How to correctly resize a .ico file without blurring it

Post by JoeShu95 »

fmw42 wrote: 2019-10-04T16:23:20-07:00 try

Code: Select all

convert input.ico -sample 64x64 output.ico
I tried this command, but it is still very blurry, could you please help take a deeper look? Thank you!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to correctly resize a .ico file without blurring it

Post by fmw42 »

Try this

(unix syntax)

Code: Select all

convert input.ico -delete 1--1 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -background none output.ico

or

(windows syntax)

Code: Select all

convert input.ico -delete 1--1 ^
( -clone 0 -resize 16x16 ) ^
( -clone 0 -resize 32x32 ) ^
( -clone 0 -resize 48x48 ) ^
( -clone 0 -resize 64x64 ) ^
-delete 0 -background none output.ico

Or just remove the higher resolution parts.

Code: Select all

convert input.ico -delete 0-3 -background none output.ico
Post Reply