hacceuee / s3-pixel-icons

Custom Pixel Icons for Splatoon 3 - for use on stat.ink
Other
8 stars 1 forks source link

Optimize PNG files with pngcrush #14

Closed fetus-hina closed 11 months ago

fetus-hina commented 11 months ago

Optimize PNG files to reduce file size when publishing to NPM. With this patch, you can deploy image files that are exactly the same on the screen, but with about half the file size.

Before the patch:

npm notice package size:  310.8 kB                                
npm notice unpacked size: 336.8 kB                                

After the patch:

npm notice package size:  145.5 kB
npm notice unpacked size: 153.6 kB

Technical Details: Due to its specifications, a PNG file can represent the exact same image data in multiple ways. There are probably a thousand combinations of the major representations, but it would take too long to try them all, so image processing applications (e.g., photoshop and mspaint) usually try one or a few different combinations to create a file. pngcrush tries those combinations and looks for the smallest possible combination. Therefore, the smaller size caused by this patch is not due to degradation, not like JPEG.

In addition, pngcrush is set to remove unnecessary chunks. This removes trivial information, such as the name of the software used to create the file, for example, and saves dozens of bytes.