LazyFix tool

The LazyFix Tool is a tool that fixes masks considered invalid or improper by PGE (such as for example when the mask is the same as the front image). Improper masks cause issues due to the algorithm used in PGE not being able to properly render these types of masks.

Alpha-channAlpha-channel masks
A mask is an Alpha-channel coding image. Each pixel of the masks defines the level of opacity to be considered for the equivalent pixel on a source image:

Each pixel in a mask defines the value of opacity for the equivalent pixel in a source image:

How it works
Due to an invalid/improper mask being a copy of source image, we must compare all pixels between an image and its mask.

Note that before the 2.0 version's newer algorithm was implemented, pixels were filled with the color black if they were equal.

The new algorithm namely is:
 * Create an empty image ' Destination ' with the same size as the original image and fill with the gray Rgb(128,128,128) color.
 * Fetch each pixel of the ' ForegroundImage ' and use the same pixel indexes on the ' Mask ' and ' Destination ' images and then apply per-pixel operations:
 * Apply bitwise AND between R, G and B pixel values of ' Mask ' and ' Destination ' and write into the destination.
 * Calculate the alpha-channel value with a formula:
 * Set the alpha channel value for this pixel equal to ' newAlpha '
 * Apply bitwise OR between R, G and B pixel values of ' ForegroundImage ' and ' Target ' and write them into the target without modification of the alpha-channel value.
 * Calculate the new alpha-channel value with formula:
 * If ' newAlpha ' is going to have a value above 255 - set it to 255.
 * Copy all pixels of ' newAlpha ' value.

These operations would create a mask considered valid by PGE in comparison to an improper or broken specified source mask.

How to use
The LazyFix tool is a console tool.

You will need to first of all open a terminal or command line and change directories to wherever its located on your machine.

This utility also fixes SMBX64 graphics (GIF with mask images) in a selected folder and (optionally) all graphics inside a selected folder's subfolders.

An improper source mask must be placed in the same directory alongside its source image, as the fixing process is based on calculating broken pixels by comparing between the pixels of both images.

For fixing graphics which are in one folder: For fixing graphics of an entire episode, the "-d" switch may be used:

Note: After its done running, the source masks that existed before the tool was run will be placed in a directory called " _backup ". This way, if you encounter errors after running it, you can restore the original source mask images from the backup directory.

You can skip the creation of backup directories with the usage of the "-n" switch. However, you now won't be able to fix your old images, and will need to draw a mask manually:

Usage of the LazyFix tool for single images
It's possible to also drag image files into the LazyFix application such as you would into a folder in most desktop environments. This will automatically cause the tool to begin fixing those images.

Example for the Microsoft Windows Example for the Linux and Mac OS X

The LazyFix tool with a GUI
The PGE Editor includes a GUI shell for setting properties related to the LazyFix tool.

In order to try this, navigate using the menu item: " Tools -> External tools -> Fix Lazily-made graphics (LazyFix tool) "

You can also configure properties for fixing a batch of images. Once "Start" is pressed, the "Development Console" window will now be launched and the tool's fixing process should now be visible.

Links

 * LazyFix Tool Manual
 * Download latest LazyFix tool