Reducing .PNG file size

Discuss or share your car-related work here

Moderator: kilo

Reducing .PNG file size

Postby chad3006 » Tue Jan 28, 2014 9:46 pm

On some of the cars I've made I've used a web app called TinyPNG (https://tinypng.com). It reduces the filesize while preserving the alpha channel (transparency). But I also discovered a command line version called pngquant (http://pngquant.org) that apparently uses the same algorithm that TinyPNG uses. There is some loss in image quality, but I've personally not found it very noticable. Anyway, I though it might be a handy tool for SD.
User avatar
chad3006
 
Posts: 243
Joined: Mon Aug 13, 2012 7:56 pm
Location: USA

Re: Reducing .PNG file size

Postby mungewell » Tue Jan 28, 2014 11:58 pm

We might also want to ensure that we're not packing extrenuous files:
http://sourceforge.net/apps/trac/speed-dreams/ticket/217

There also the question whether we can save space by symlinking identical files in the installers.
Simon
mungewell
 
Posts: 307
Joined: Fri May 20, 2011 4:05 pm
Location: Southen Alberta, Canada

Re: Reducing .PNG file size

Postby super7 » Fri Mar 21, 2014 11:09 pm

chad3006 wrote:On some of the cars I've made I've used a web app called TinyPNG (https://tinypng.com). It reduces the filesize while preserving the alpha channel (transparency). But I also discovered a command line version called pngquant (http://pngquant.org) that apparently uses the same algorithm that TinyPNG uses. There is some loss in image quality, but I've personally not found it very noticable. Anyway, I though it might be a handy tool for SD.


At least with tracks and their textures, optipng (available in the repos) is IMO better than pngquant. A very small command-line program easy enough to use, and normally, there's no loss in image quality like there may be with pngquant or pngcrush.

Code: Select all
cd name_of_folder_with_image
optipng -o5 nameofimage.png


If you really want to push it, use -o7, though that takes much longer. Anyway, it might be a good idea not to optimize black-and-white or grayshade images (with already small file sizes). I've noticed optipng sometimes converts such RGB images to indexed images, which may ruin them so that the game won't display them correctly. However, with "normal", more colorful images, the optimization will work pretty well, with reductions of 10%-20%, sometimes even more. With larger images (1024x1024 or more), the reduction may be less, but still noticeable. If you're hesitant, make backups of the images before running optipng.

I hope this helps you a little.
super7
 
Posts: 19
Joined: Thu Aug 30, 2012 8:54 am

Re: Reducing .PNG file size

Postby chad3006 » Mon Mar 24, 2014 12:38 pm

OK, I wasn't aware of Optipng.
User avatar
chad3006
 
Posts: 243
Joined: Mon Aug 13, 2012 7:56 pm
Location: USA


Return to SD Cars

Who is online

Users browsing this forum: No registered users and 2 guests

cron