Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize PNG images losslessly using zopflipng #151

Closed

Conversation

PeterDaveHello
Copy link
Contributor

This commit applies extreme, lossless optimization to PNG images using zopflipng. The aim is to reduce the overall size of the releases.

As the result, there are 29 PNG images recompressed as below:

app/src/main/ic_launcher-playstore.png                     | Bin 100398 -> 62188 bytes
app/src/main/res/drawable-hdpi/ic_bluetooth_off.png        | Bin 320 -> 238 bytes
app/src/main/res/drawable-hdpi/ic_map_zoom.png             | Bin 382 -> 275 bytes
app/src/main/res/drawable-mdpi/ic_bluetooth_off.png        | Bin 238 -> 191 bytes
app/src/main/res/drawable-mdpi/ic_map_zoom.png             | Bin 270 -> 206 bytes
app/src/main/res/drawable-xhdpi/ic_bluetooth_off.png       | Bin 389 -> 290 bytes
app/src/main/res/drawable-xhdpi/ic_map_zoom.png            | Bin 462 -> 291 bytes
app/src/main/res/drawable-xxhdpi/ic_bluetooth_off.png      | Bin 523 -> 361 bytes
app/src/main/res/drawable-xxhdpi/ic_map_zoom.png           | Bin 692 -> 393 bytes
app/src/main/res/mipmap-hdpi/ic_launcher.png               | Bin 5388 -> 4017 bytes
app/src/main/res/mipmap-hdpi/ic_launcher_background.png    | Bin 3086 -> 1473 bytes
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png    | Bin 9592 -> 7047 bytes
app/src/main/res/mipmap-hdpi/ic_launcher_round.png         | Bin 7478 -> 6618 bytes
app/src/main/res/mipmap-mdpi/ic_launcher.png               | Bin 3279 -> 2496 bytes
app/src/main/res/mipmap-mdpi/ic_launcher_background.png    | Bin 1243 -> 706 bytes
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png    | Bin 5350 -> 3772 bytes
app/src/main/res/mipmap-mdpi/ic_launcher_round.png         | Bin 4449 -> 3880 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher.png              | Bin 8028 -> 5966 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher_background.png   | Bin 3365 -> 1386 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png   | Bin 13991 -> 10372 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png        | Bin 10908 -> 9746 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher.png             | Bin 13221 -> 10219 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png  | Bin 15366 -> 3927 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png  | Bin 26255 -> 18398 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png       | Bin 18277 -> 15727 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png            | Bin 18945 -> 15141 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png | Bin 16210 -> 3532 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png | Bin 38959 -> 26823 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png      | Bin 26700 -> 22873 bytes

This commit applies extreme, lossless optimization to PNG images using
zopflipng. The aim is to reduce the overall size of the releases.

As the result, there are 29 PNG images recompressed as below:
```
app/src/main/ic_launcher-playstore.png                     | Bin 100398 -> 62188 bytes
app/src/main/res/drawable-hdpi/ic_bluetooth_off.png        | Bin 320 -> 238 bytes
app/src/main/res/drawable-hdpi/ic_map_zoom.png             | Bin 382 -> 275 bytes
app/src/main/res/drawable-mdpi/ic_bluetooth_off.png        | Bin 238 -> 191 bytes
app/src/main/res/drawable-mdpi/ic_map_zoom.png             | Bin 270 -> 206 bytes
app/src/main/res/drawable-xhdpi/ic_bluetooth_off.png       | Bin 389 -> 290 bytes
app/src/main/res/drawable-xhdpi/ic_map_zoom.png            | Bin 462 -> 291 bytes
app/src/main/res/drawable-xxhdpi/ic_bluetooth_off.png      | Bin 523 -> 361 bytes
app/src/main/res/drawable-xxhdpi/ic_map_zoom.png           | Bin 692 -> 393 bytes
app/src/main/res/mipmap-hdpi/ic_launcher.png               | Bin 5388 -> 4017 bytes
app/src/main/res/mipmap-hdpi/ic_launcher_background.png    | Bin 3086 -> 1473 bytes
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png    | Bin 9592 -> 7047 bytes
app/src/main/res/mipmap-hdpi/ic_launcher_round.png         | Bin 7478 -> 6618 bytes
app/src/main/res/mipmap-mdpi/ic_launcher.png               | Bin 3279 -> 2496 bytes
app/src/main/res/mipmap-mdpi/ic_launcher_background.png    | Bin 1243 -> 706 bytes
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png    | Bin 5350 -> 3772 bytes
app/src/main/res/mipmap-mdpi/ic_launcher_round.png         | Bin 4449 -> 3880 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher.png              | Bin 8028 -> 5966 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher_background.png   | Bin 3365 -> 1386 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png   | Bin 13991 -> 10372 bytes
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png        | Bin 10908 -> 9746 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher.png             | Bin 13221 -> 10219 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png  | Bin 15366 -> 3927 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png  | Bin 26255 -> 18398 bytes
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png       | Bin 18277 -> 15727 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png            | Bin 18945 -> 15141 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png | Bin 16210 -> 3532 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png | Bin 38959 -> 26823 bytes
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png      | Bin 26700 -> 22873 bytes
```
@PeterDaveHello
Copy link
Contributor Author

@Sn0wfreezeDev any comments can be shared?

@Sn0wfreezeDev
Copy link
Member

I'd rather not add PNGs from unknown sources for security reasons. There have been many exploits in image parsing libraries and since I don't know the compression, I don't know if it could harm the project.

@PeterDaveHello
Copy link
Contributor Author

Sure! I understand your concerns about the security risks of adding PNGs from unknown sources.

In response to your security concerns, I've used Google's Zopfli algorithm via the zopflipng CLI tool to compress the PNGs in the project. This method is fully compatible with the DEFLATE compression used in PNGs, offering unparalleled compression levels without compromising visual quality. You can verify Zopfli's credibility on its GitHub page. If the libraries in the app are up-to-date, the risk of security issues should be minimal. I'm just an open-source contributor without the capability and willingness to develop 0-day exploits to attack an open source project. You can review my GitHub profile for further assurance.

For your reference, several well-known projects have successfully adopted this compression method without issues:

I hope this information alleviates your concerns and makes the inclusion of these optimized PNGs more acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants