4

Based on this question for imagemagick, what is the equivalent for graphicsmagick? Recipe for creating Windows ICO files with ImageMagick?

Also I just want to generate a fully transparent ico file with multiple sizes. I found that there's an xc:none option that works for both, but is there one single command that generates ico files with multiple sizes that is transparent? Otherwise I would have to first create a transparent png file, then create ico files from the png file.

Community
  • 1
  • 1
CMCDragonkai
  • 6,222
  • 12
  • 56
  • 98

1 Answers1

2

AFAIK, GraphicsMagick doesn't support writing ICO format files - see here.

Just in case anyone knows more about this mad Microsoft format and if it is maybe some sort of multi-page TIF or GIF in disguise that just needs to be renamed, the following would be one way of making a recipe in GraphicsMagick:

#!/bin/bash
{ echo convert image.png mpr:initial; 
  echo convert mpr:initial -resize 16x16 mpr:16;
  echo convert mpr:initial -resize 32x32 mpr:32;
  echo convert mpr:initial -resize 48x48 mpr:48;
  echo convert mpr:initial -resize 64x64 mpr:64;
  echo convert mpr:16 mpr:32 mpr:48 mpr:64 -colors 256 favicon.tif; } | gm batch -prompt off

For the moment, I have created a multi-page TIF as the output file and it contains the four sizes you need - but as I said, GraphicsMagick will not write a ICO file.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • 2
    The format is described here: https://en.wikipedia.org/wiki/ICO_(file_format) . You'd write the simple header and offset table, followed by a set of PNG datastreams. GraphicsMagick doesn't support writing ICO files, but it probably wouldn't be difficult to implement. – Glenn Randers-Pehrson Jul 31 '16 at 14:50
  • wow, i thought ImageMagick and `gm` had feature parity... Guess I'll have to install IM, then! – cnst Sep 23 '17 at 03:41