# VBForums UtilityBank > UtilityBank - Utilities >  Utility: PngSizer - Resize PNG files without losing alpha transparency

## dilettante

*Title*

PngSizer


*Description*

A small GUI utility for resizing PNG image files, typically icon images for use in your programs, without losing alpha channel information.

Compiled EXE included in the attached archive.


*Features*

Drag and drop or copy and paste a file from a Windows Explorer instance.  Then choose new dimensions and click Save.

Can overwrite the original file, or create a new file in the same folder named with an inserted "-new" suffix.

Can optionally run the PNGOUT.EXE utility upon saving if present in the same folder as PngSizer.exe itself.  You can obtain the PNGOUT optimizer utility from the author's official web page:

Ken Silverman's Utility Page
Compression Utilities

*Screen-shots*



Sample file folder.png dropped onto PngSizer, Half button clicked




Save clicked, PNGOUT run completed

*Author name*

Bob Riemersma


*System Requirements*

Run Time

EXE requires Windows Vista or later (will run on Windows XP if the optional WIA 2.0 "WIAAUT" package has been installed).

Optionally can make use of PNGOUT.EXE (see above for download page).
Recompiling

Windows Vista or later (or Windows XP with WIAAUT).

VB 6.0 Professional or Enterprise.

*License info*

Public domain "freeware."  Feel free to make any use of the program or its source code that you choose.

The author accepts no liability for any negative consequences of the use of the compiled program or derivative works based on its source code.

This is "as-is" software.


*Other remarks*

The main use for this program is to convert a larger sized PNG "icon" image with alpha channel transparency and translucency to a smaller more compact size for use in your own programs.  This should reduce the final size of your programs even if you resize such images to fit at run time.

Note that usually you won't want to resize down too far, unless you are targeting your exact final size.  If your programs are doing run time resizing and alpha blending (e.g. for dealing with High DPI) you may want to avoid making your source images too small.  A larger image preserves more definition from the original image, making your final images look a little better.

The quality of the result may vary if you pixel-slice... for example a 256x256 image resized to 128x128 is pretty clean while 256x256 to 105x105 might result in excessive aliasing effects.  Avoid this when using PngSizer to create smaller source images for use by your programs.

The archive contains a sample PNG file (folder.png) for testing.

The bulk of the code in PngSizer is either user interface management logic or code used to run the external PNGOUT.EXE utility when available.  The amount of code to do the image resizing itself is actually pretty small, delegating the heavy lifting to WIA 2.0 objects.


*DFS - Drag-file source*

The attached archive also includes the source to the DFS helper utility.

When you are testing within the VB6 IDE it should (as always) be running with elevated permission.  Due to system process integrity rules drag and drop will not work with a non-elevated drag source (i.e. Windows Explorer).  See Windows Vista Integrity Mechanism Technical Reference for more information.

If you compile the DFS program ahead of time, you can use it for testing drag and drop with PngSizer running within the elevated IDE.  Running DFS displays a listbox containing all of the PNG files in the directory it is running from (App.Path in VB6 terms).  You can click one of these to select it, then click and drag it to the running PngSizer window.

----------


## dilettante

Note:

While the included "folder.png" is NOT mine, it is marked "Creative Commons (Attribution 3.0 Unported)" at:

Iconizer.net

The README states:




> Shimmer Icons By: Creative Freedom Ltd
> License: Creative Commons (Attribution 3.0 Unported)
> Count: 21 Icon set page: http://www.creativefreedom.co.uk/icon-design
> Shimmer Icons - Free Set
> -------------------------------
> The 'Shimmer' Icon style is Windows 7 style variant, 20 unique icons are provided free for use in commercial or non-commercial applications, the designs may not be altered in any way and the following attribution must be used, including the link.
> 
> http://www.creativefreedom.co.uk/icon-design/ - Icon Design by Creative Freedom
> All copyright for Shimmer Icons belongs to Creative Freedom Ltd.
> ...


The particular file under discussion is a folder image, and if you really need a smaller size you might go to the source and grab one of those made available there instead of resizing it.

----------

