
 ConvertToPngIcon is a shell script for the conversion
 of all Amiga icon formats into PNG images and icons.
 Of course, it can not store old planar images in PNG. 

 This was inspired by similar scripts written by James.

 The script can be started from a shell or executed by
 the Workbench Tools-Menu or launched from an app-icon.

 By default it will convert the source icon in place !
 Backups of the source icons are stored in T:OldStyle.



 Requirements: OS v44+, 68020+, FPU, gfx-card, P96/CGX
 ============

 In C: or any other location for commands in your PATH:
 ~~~~

 ConvertToPngIcon with the S and E protection bits set
 ImageConverter by Thilo Koehler which is doing the job
 CopyIcon by Stephan Rupprecht, for copying the images
 ProcessIcon by Dirk Stoecker, optional for planar icons
 PngCrush by Glenn Randers-Pehrson, optional compression

 ( RequestFile, Join, LoadResource as part of AmigaOS )


 In Libs:
 ~~~~~~~
 ab3support.library by Thilo Koehler for ImageConverter
 it needs jpeg.library, wizard.library, newicon.library

 ixemul.library for PngCrush, for optimal PNG compression

 icon.library since #576, working on RTG in TrueColor !!

 (without my options ConvertTrueColor or ConvertPngToOS4,
  unless you want to save icons in OS 3.5 or OS4 format)


 For the DropView GUI (alias ConvertIcon, ConvertTo46x46)

 In Fonts: XHelvetica.font size 11
 ~~~~~~~~
 In the startup-sequence or user-startup:
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 LoadResource >NIL: Fonts:XHelvetica.font/11 LOCK

 as a bugfix for "Error 2" when it tries to open the GUI,
 but you can also change the DropView tooltypes directly,
 for example: "VIEWER=ConvertToPngIcon WIDTH 64 HEIGHT 64"



 Script usage:
 ============

 ConvertToPngIcon WIDTH/K/N,HEIGHT/K/N,FORCE/K/S,CRUSH/K/S,FILENAME/F

 WIDTH, HEIGHT and FORCE are options, for size scaling only
 CRUSH is a switch to use PngCrush for optimal compression
 FILENAME takes the remaining input string as an icon name,
 but this can be omitted and you will see a file requester. 

 The script can only convert one icon at a time, no multi-
 selection. You can execute it from the shell directly or
 by selecting an icon and launching the script by WB menu.
 And you can also start "ConvertIcon" to get the DropView
 app-icon on the Workbench to where you may Drag 'n Drop.

 By default this script will write the converted images back
 to the original files. If you don't want that, comment out
 the last "Copy" command in the script, then use T:NewStyle.

 The script accepts and forwards the ImageConverter options
 "WIDTH", "HEIGHT" and "FORCE", if you want to scale icons
 to a certain size. Width and height are maximal values for
 the larger dimension of the image, but will keep the aspect
 unless you also set the option "FORCE" in the command line
 before the filename string is supplied. Force will ignore
 the aspect ratio of the source image by scaling to w and h.

 For optimized PNG compression you can add the CRUSH keyword
 to the command line, which will try to use PngCrush to find
 the best filter method for the image data. This may need a
 lot of time for trying many strategies, but can save space.
 There are also PngCrush versions for 040/060 CPUs on Aminet.

 From ConvertIcon GUI you could call the script as a viewer:

 "ConvertToPngIcon WIDTH 46 HEIGHT 46" (by CLI for scaling)

 Similar instructions should work from the WB tools menu. 

 Read the ImageConverter syntax for more possible options,
 but all other options have to be added in the script to the
 ImageConverter command lines, not as script call options.


 There are some directories which are created by the script: 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 T:OldStyle for backup copies of the original source icons 
 T:PngImages for the PNG images created by ImageConverter
 T:PngIcons for the joined images with the .info extension
 T:NewStyle for the converted PNG icons with all attributes


 ImageConverter still modifies the icon images a bit, since
 it can't get the original ARGB data from icon.library directly.
 My icon.library only updates the RGB data after merging the
 image and the background by using the alpha channel values.
 ImageConverter lets my library write the image twice: once
 to a white background and once to a black background, and
 then it recalculates the none supplied alpha values and RGB
 colors from the differences of these two images. The resulting
 ARGB data is quite good, but not exact for very low alpha
 values, because the fading with alpha is some sort of a lossy
 data processing, you are losing the fractions in the
 calculations, the colors can only be mixed in 256 steps for
 each RGB component, not perfectly. But usually, that little
 difference won't be visible for the user.

 
