Skip to main content
added `-colors 16` flag isn't doing what is claimed..
Source Link

My goal is to take an ico-image, like this wikipedia.ico and flip it vertically. My first attempt was

$ convert -flip wikipedia.ico flipped.ico

And it works, except that the resulting file flipped.ico is larger than the original:

$ identify wikipedia.ico 
wikipedia.ico[0] ICO 48x48 48x48+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 2734B 0.000u 0:00.000

$ identify flipped.ico 
flipped.ico[0] ICO 48x48 48x48+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[1] ICO 32x32 32x32+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[2] ICO 16x16 16x16+0+0 8-bit sRGB 15086B 0.000u 0:00.000

Adding the flag -depth 4 does not help.

How can I do I get the exact same image, simply flipped?

Edit:

Thanks to Paolo Gibellini's answer, it got a smaller file flipped.ico. However, using -colors 16 -depth 4 still results in a file, that is much larger than the original:

$ convert -flip -colors 16 -depth 4 wikipedia.ico flipped.ico
$ ls -l flipped.ico wikipedia.ico
[...] 10734 May 14 21:05 flipped.ico
[...]  2734 May 14 09:41 wikipedia.ico
$ identify flipped.ico 
flipped.ico[0] ICO 48x48 48x48+0+0 8-bit sRGB 10734B 0.000u 0:00.009
flipped.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 10734B 0.000u 0:00.000
flipped.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 10734B 0.000u 0:00.000

I am running this on a debian pc. In the first line, there still seems to be some 8-bit image. Is there a way to have flipped.ico exactly the same size? Dos this really work on windows, as mentioned in the answer?

My goal is to take an ico-image, like this wikipedia.ico and flip it vertically. My first attempt was

$ convert -flip wikipedia.ico flipped.ico

And it works, except that the resulting file flipped.ico is larger than the original:

$ identify wikipedia.ico 
wikipedia.ico[0] ICO 48x48 48x48+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 2734B 0.000u 0:00.000

$ identify flipped.ico 
flipped.ico[0] ICO 48x48 48x48+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[1] ICO 32x32 32x32+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[2] ICO 16x16 16x16+0+0 8-bit sRGB 15086B 0.000u 0:00.000

Adding the flag -depth 4 does not help.

How can I do I get the exact same image, simply flipped?

My goal is to take an ico-image, like this wikipedia.ico and flip it vertically. My first attempt was

$ convert -flip wikipedia.ico flipped.ico

And it works, except that the resulting file flipped.ico is larger than the original:

$ identify wikipedia.ico 
wikipedia.ico[0] ICO 48x48 48x48+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 2734B 0.000u 0:00.000

$ identify flipped.ico 
flipped.ico[0] ICO 48x48 48x48+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[1] ICO 32x32 32x32+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[2] ICO 16x16 16x16+0+0 8-bit sRGB 15086B 0.000u 0:00.000

Adding the flag -depth 4 does not help.

How can I do I get the exact same image, simply flipped?

Edit:

Thanks to Paolo Gibellini's answer, it got a smaller file flipped.ico. However, using -colors 16 -depth 4 still results in a file, that is much larger than the original:

$ convert -flip -colors 16 -depth 4 wikipedia.ico flipped.ico
$ ls -l flipped.ico wikipedia.ico
[...] 10734 May 14 21:05 flipped.ico
[...]  2734 May 14 09:41 wikipedia.ico
$ identify flipped.ico 
flipped.ico[0] ICO 48x48 48x48+0+0 8-bit sRGB 10734B 0.000u 0:00.009
flipped.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 10734B 0.000u 0:00.000
flipped.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 10734B 0.000u 0:00.000

I am running this on a debian pc. In the first line, there still seems to be some 8-bit image. Is there a way to have flipped.ico exactly the same size? Dos this really work on windows, as mentioned in the answer?

Source Link

flip an ico-image without quality loss or size increase

My goal is to take an ico-image, like this wikipedia.ico and flip it vertically. My first attempt was

$ convert -flip wikipedia.ico flipped.ico

And it works, except that the resulting file flipped.ico is larger than the original:

$ identify wikipedia.ico 
wikipedia.ico[0] ICO 48x48 48x48+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[1] ICO 32x32 32x32+0+0 4-bit sRGB 2734B 0.000u 0:00.000
wikipedia.ico[2] ICO 16x16 16x16+0+0 4-bit sRGB 2734B 0.000u 0:00.000

$ identify flipped.ico 
flipped.ico[0] ICO 48x48 48x48+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[1] ICO 32x32 32x32+0+0 8-bit sRGB 15086B 0.000u 0:00.000
flipped.ico[2] ICO 16x16 16x16+0+0 8-bit sRGB 15086B 0.000u 0:00.000

Adding the flag -depth 4 does not help.

How can I do I get the exact same image, simply flipped?