Changes black transparent pixels to match the nearest color for proper blending.
Changes the colors of completely transparent pixels in an image to match the color of the nearest non-transparent pixel.
Designed to be a quick drag-and-drop tool:
When saving an image file, most image editors will save completely transparent pixels as black. On some platforms, the resizing algorithm blends transparent pixels with non-transparent pixels, resulting in black edges on resized images. Here is an article showing the difference and discussing techniques to fix the issue.
This script keeps those pixels transparent, but changes their color to match the nearest non-transparent pixel. This means that when the non-transparent and transparent pixels are blended, there should be no color difference.
This script is made into an executable using the pkg tool.
pkg -o pixelfix -t node10-win-x64,node10-win-x86,node10-macos-x64,node10-linux-x64 .\index.js