MTA Anti-Cheat Team Popular Post Dutchman101 Posted July 28, 2019 MTA Anti-Cheat Team Popular Post Share Posted July 28, 2019 I want to share this tool and method to optimize PNG files, which are used a lot in gamemodes. This topic will focus on a tool called ZopfliPNG (which I built from source and will provide a file download for) - refer to the bottom of this topic, step 2 for that. https://github.com/google/zopfli Because of the intensive usage of PNG in MTA, optimizing them will benefit total download size for players and performance. 1) use Paint.NET software (https://www.getpaint.net/) to resize your image's resolution (CTRL + R), for example half it with the power of 2, like 256 x 256 to 128 x 128. Depending on the type of image or how far whatever script zooms it, you can go beyond that and make it even lower. Use default settings for saving it, you don't have to worry about size optimization yet. Drawing a lot of high resolution images or textures will affect client performance, and cause lag on low-end PC's. So following this step is highly recommended. You can always gauge the quality outcome while you're saving it using a lower resolution. Note: you can skip this step, if you care more about file & DL size rather than client rendering/memory performance, or if the type or usage of your image(s) result in rapid deterioration in quality upon resizing. By not doing this, and sticking to the main subject of this guide, ZopfliPNG from step 2, you will keep the same quality but only get a file size reduction. After doing the initial optimization with Paint.NET, which is the part that matters to client (rendering) performance, you'd usually think that is the end of it, that the file size Paint.NET outputs (on the various saving profiles, like bit depths, you compare) is the best you can get. But you're wrong, since advanced software like ZopfliPNG can squeeze more out of it, notably most of all without any quality decrease. It's software that assembles PNG format compression from scratch, with all pixels matching 100%. So there's no reason not to do it, also if you didn't initially use step 1) about Paint.NET resizing/actual image tweaks. So, to get a lower size, it's not neccesary to compromise more of your image quality using editing, like resize even more in Paint.NET. So now to get to the point of this guide; 2) ZopfliPNG Download it from: LINK (click) Usage instructions are in the README.txt files in either 32-bit or 64-bit version folders. It's a command-line utility, you can use it in the simplest way by entering this into cmd from the binary's location (after copying your png files): Quote zopflipng.exe image.png image.png This will optimize the file using default configuration, which guarantees 100% matching pixels (absolutely no worse quality) and usually a huge reduction in file size. As I mentioned in one of the notes, you will benefit also if you won't "pre-process" your PNG's using Paint.net, but only use ZopfliPNG, to not possibly impact your quality but still get a lower resources download size. As you can see here; I made sure to document its usage (README.txt) and included mass optimization (multiple files at once) .bat files, their usage also explained in README.txt. Unfortunately this is as close we can get to mass-optimizing files, because i built zopflipng.exe from original ZopfliPNG source code (https://github.com/google/zopfli) and it doesn't currently feature it in a more convenient way (without having to edit/specify ranges of file names to optimize). Here's some additional information on ZopfliPNG and why it is so groundbreaking over other compression tools: https://ariya.io/2016/06/using-zopfli-to-optimize-png-images https://blog.codinghorror.com/zopfli-optimization-literally-free-bandwidth/ No other tool can theoretically achieve this, let alone with 100% quality preservation. It's state-of-the-art technology. Edit (25th Dec 2019): updated ZopfliPNG binaries (re-built from latest official repository version) 10 4 Link to comment
BrotherBob Posted January 11, 2022 Share Posted January 11, 2022 sorry, can you make a video tutorial? S I still don't know how to run it 2 minutes ago, BrotherBob said: sorry, can you make a video tutorial on YouTube? I still don't know how to run it Thanks Link to comment
noahmadi Posted February 23 Share Posted February 23 Thanks for sharing this PNG optimization tool! It's awesome to see community members like you contributing to improving performance in gamemodes. Using ZopfliPNG sounds like a great way to optimize PNG files, especially considering how heavily they're used in MTA. Reducing the download size for players and improving performance is always a win-win. For anyone looking to further optimize their images, they can also consider compressing them using tools like this compress image website. This can help reduce file sizes without sacrificing too much quality. 2 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now