PngIron
=======

[text formatted for wordwrap]

Version 1.1
02-December-2015
Robert Riemersma

This is a small GUI utility intended to help you pre-process small PNG format images that have alpha channel transparency and translucency.  Additional work may need to be done on the output saved by this program using another more generalized image editing tool.

Often programmers using classic Visual Basic need small bitmap images for use in making icons and images for use with common Visual Basic controls.  But many times they can find free images that might be useful except for being alpha-PNG images.  Instead what is needed is "maskcolor" transparency, or in some cases GIF-transparency will do.

This program can help iron out or "flatten" alpha-PNG images against a selected maskcolor and save this composited image to disk as a new PNG file.  Such a flat PNG can be easier to work with using other tools to make a final product.

But PngIron is a one-trick pony, not a general purpose graphics tool.  Most versions of Windows Paint can be valuable in finishing up, and other tools like the popular IrfanView can help with this stage too.


Requrements, Installing PngIron
===============================

PngIron consists of a single EXE.  You can copy this to any folder and create shortcuts as needed to run it.

There are no extra DLLs or OCXs to install.  However it does make use of WIA 2.0 and Shell32 4.71 or later.

This means it requires Windows Vista or later.  If you have a machine with Windows 2000 SP4 or Windows XP SP1 or later and it has WIA 2.0 installed then it should work there as well.  However Microsoft no longer provides the necessary DLL for installation into those unsupported systems.


Compiling PngIron
=================

Nothing special is required here.  You just need Visual Basic 6.0 (Professional Edition or better) installed on a Windows Vista (or later) PC.  It can also be compiled under Windows XP SP1 to SP3 and Windows 2000 SP4 as long as you have the WIA 2.0 SDK installed there.


What PngIron Does
=================

First you open an existing alpha-PNG file, which Pngiron will display.  If the file has no alpha information PngIron will let you know and things end there.

Otherwise you can:

o Set a maskcolor.

o Choose an alpha threshold level for flattening that eliminates fringing and shadows as desired.

o "Knock out" stray pixels by replacing them with the maskcolor or selected paintcolors.

o Reduce the color count via a simple algorithm.

You can fiddle with the various settings until the image is clean enough for use.  Then you can save it as a new PNG file.


Limitations
===========

PngIron does not save in BMP format because it is bulky.  It does not save as GIF because it doesn't have enough control of the image.  Save as GIF would often end up with "dithered" colors.

Many operations such as a change to the alpha threshold can be slow due to the way PngIron is working with these images.  You will want to avoid working with images much larger than 256x256 pixels - they work but things can slow down quite a bit as you make changes.

No attempt has been made to deal with DPI settings higher than the standard 96dpi display setting.

With more effort PngIron could be modified to reduce or eliminate these limitations.  If you need to do a lot of this you might want to consider more generalized and more powerful image editing tools.


License
=======

Microsoft Public License (Ms-PL)

This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.

1. Definitions

The terms reproduce, reproduction, derivative works, and distribution have the same meaning here as under U.S. copyright law.

A contribution is the original software, or any additions or changes to the software.

A contributor is any person that distributes its contribution under this license.

Licensed patents are a contributors patent claims that read directly on its contribution.

2. Grant of Rights

(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.

(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.

3. Conditions and Limitations

(A) No Trademark License- This license does not grant you rights to use any contributors name, logo, or trademarks.

(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.

(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.

(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.

(E) The software is licensed as-is. You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
