Page 1 of 1

Create IOC file from any PNG

Posted: 2012-06-27T13:55:20-07:00
by laeatwork
Hi,

I struggling to create new icons with the following format

Code: Select all

  Type: PaletteMatte
  Endianess: Undefined
  Colorspace: RGB
  Depth: 24/8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit
I have tried MANY different convert argument butt still no success.
All tries ends up in one of the following, which is not accepted in the VB6 environment where I need to patch.

Code: Select all

  Depth: 32/8-bit
or

Code: Select all

  Depth: 8-bit
Any ideas are appreciated.

/Lars

Re: Create IOC file from any PNG

Posted: 2012-06-27T15:56:21-07:00
by glennrp
You need to remove the alpha channel. In older versions of ImageMagick the
option was "+matte" but I think you can now use "-alpha off" or "-alpha remove".

If you want to keep the alpha channel but reduce it to 1-bit, you can use
the PNG8 format (convert file.png png8:reduced.png).
  • glenn.rp> convert logo: -transparent white png8:logot.png
    glenn.rp> identify -verbose logot.png
    Depth: 8-bit
    Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit
The "Depth: 8-bit" is not what's actually in the file. The
individual Channel depths are correct.

Re: Create IOC file from any PNG

Posted: 2012-06-27T22:00:45-07:00
by laeatwork
Thanks for the reply. I thing I have control over the Alpha channel.
It is the Depth settings that fools me.

If I do as follows:
  • Use image magic to convert a PNG to an IOC file.
  • This ICO file is not accepted by VisualBasic 6 as an ico file.
  • Open the ICO file using iconfx utility
  • Set the file "File data type" to TrueColor (24 bits)
  • Then the ICO file i accepted by VB6
If I dump the two ICO files using identify -verbose the difference looks like follows:

Code: Select all

--- im.txt	2012-06-28 06:39:56.755668800 +0200
+++ fx.txt	2012-06-27 22:25:29.701739500 +0200
@@ -8,7 +8,7 @@
   Type: PaletteMatte
   Endianess: Undefined
   Colorspace: RGB
-  Depth: 32/8-bit
+  Depth: 24/8-bit
   Channel depth:
     red: 8-bit
     green: 8-bit
@@ -185,14 +185,14 @@
   Orientation: Undefined
   Properties:
     date:create: 2012-06-27T22:04:26+02:00
-    date:modify: 2012-06-28T06:39:56+02:00
-    signature: 10cc0817061ac04af42fdc1aa024cc231542c345e2c92adfc35c8a0a91396e10
+    date:modify: 2012-06-27T22:21:42+02:00
+    signature: a939711538ded9c9a5738d4cd655d9e2613d3c9136248359c3cf667f5f7f2d16
   Artifacts:
     verbose: true
   Tainted: False
-  Filesize: 4.29KB
+  Filesize: 3.26KB
   Number pixels: 1.02K
-  Pixels per second: 1.025MB
+  Pixels per second: 1.023MB
   User time: 0.000u
-  Elapsed time: 0:01.000
+  Elapsed time: 0:01.001
   Version: ImageMagick 6.7.5-4 2012-02-06 Q16 http://www.imagemagick.org
As you can see the only significant change is the depth settings. IM uses 'Depth: 32/8-bit' and ICON FIX 'Depth: 24/8-bit'

How do I tell IM to set Depth: 24/8-bit ?

/Lars

Re: Create IOC file from any PNG

Posted: 2012-06-28T20:09:27-07:00
by anthony
24 bit is 8 bits RGB but no alpha channel.

So don't save a alpha channel.
Use -alpha off before the save. Or use png24: