Reduce filesize of images, pictures, etc.

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
User avatar
Friar Tuck
Newbie
Posts: 11
Joined: Sat Apr 26, 2014 1:10 am
Projects: The Clockwork Diary with Copper Clasps
Contact:

Reduce filesize of images, pictures, etc.

#1 Post by Friar Tuck » Sat Apr 26, 2014 4:05 am

Steps for tiny creators:
If your picture not use transparency, then save this picture as jpg.
Resave all jpg pictures in MS Paint. It is reduce filesize to 50% or more.

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Reduce filesize of images, pictures, etc.

#2 Post by AxemRed » Sat Apr 26, 2014 5:11 am

>Resave all jpg pictures in MS Paint. It is reduce filesize to 50% or more.
Never resave JPEGs, it degrades quality dramatically (and JPEG does a poor job of compressing its own compression artifacts).
Never use MS Paint to produce JPEGs, its results are very poor compared to other programs.

User avatar
Tempus
Miko-Class Veteran
Posts: 519
Joined: Sat Feb 16, 2013 3:37 am
Completed: Ladykiller in a Bind
Projects: StoryDevs
Tumblr: jakebowkett
Deviantart: jakebowkett
Github: jakebowkett
Location: Australia
Contact:

Re: Reduce filesize of images, pictures, etc.

#3 Post by Tempus » Sat Apr 26, 2014 7:03 am

What Axem said is right. I'll also add that there are cases where PNGs occupy less disk space than equivalent JPEGs. I've attached two 2000 x 2000 images made from the same master file, one a PNG and the other a JPEG. The PNG is 22.4kb while the JPEG is 50.9kb. By knowing how the compression algorithms of each work people can make smart choices about when to use each. In general if an image requires no transparency it's usually best to save it as a JPEG like you said, but it's good to be aware that there are exceptions.
Attachments
example_JPEG.jpg
example_PNG.png
StoryDevs — easy-to-search profiles for VN devs (under construction!)

User avatar
Friar Tuck
Newbie
Posts: 11
Joined: Sat Apr 26, 2014 1:10 am
Projects: The Clockwork Diary with Copper Clasps
Contact:

Re: Reduce filesize of images, pictures, etc.

#4 Post by Friar Tuck » Sat Apr 26, 2014 7:14 am

AxemRed wrote:>Resave all jpg pictures in MS Paint. It is reduce filesize to 50% or more.
Never resave JPEGs, it degrades quality dramatically (and JPEG does a poor job of compressing its own compression artifacts).
Never use MS Paint to produce JPEGs, its results are very poor compared to other programs.
Are you knew any software for produce good/perfect results to reduce filesize without "degrades quality dramatically"?
Tell about this.

User avatar
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Reduce filesize of images, pictures, etc.

#5 Post by SundownKid » Sat Apr 26, 2014 7:25 am

You should use TinyPNG instead. https://tinypng.com/ It does image compression without ruining the image like saving it in jpeg does. And it has a comparable file size to a JPG file.

For the most part the compression isn't noticeable except for some minor color changes.

User avatar
Friar Tuck
Newbie
Posts: 11
Joined: Sat Apr 26, 2014 1:10 am
Projects: The Clockwork Diary with Copper Clasps
Contact:

Re: Reduce filesize of images, pictures, etc.

#6 Post by Friar Tuck » Sat Apr 26, 2014 7:46 am

Can I use tinypng plugin in Paint.Net?

User avatar
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Reduce filesize of images, pictures, etc.

#7 Post by SundownKid » Sat Apr 26, 2014 7:59 am

It only has a (paid) Photoshop plugin unfortunately, you will have to do it manually the drag-and-drop way.

It's a little tedious to download them individually, but the results are a lot better quality than saving them as JPG.

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Reduce filesize of images, pictures, etc.

#8 Post by AxemRed » Sat Apr 26, 2014 8:50 am

Friar Tuck wrote:Are you knew any software for produce good/perfect results to reduce filesize without "degrades quality dramatically"?
Tell about this.
The problem isn't JPEG, the problem is resaving JPEGs. Keep all your files in a lossless format (for example PNG), then batch-convert them to JPEG during your build process. Photoshop's Save for Web is among the best JPEG compressors, but there are hundreds of them out there. I personally use XnView/nconvert.
SundownKid wrote:You should use TinyPNG instead. https://tinypng.com/ It does image compression without ruining the image like saving it in jpeg does. And it has a comparable file size to a JPG file.
256-color PNGs sound fine in theory, but they have random failure cases where the image looks awful. That means you kind of have to go over every single image by hand to make sure they look fine. It's also a technique that works best on tiny images and doesn't scale well to HD resolution sprites.

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Reduce filesize of images, pictures, etc.

#9 Post by Asceai » Sat Apr 26, 2014 9:15 am

Trick I worked out for saving sprites:

Some people save sprites as two JPEGs with one JPEG having the bitmap layer and another JPEG using the transparency layer. This is a pretty good approach, because ren'py offers im.AlphaMask, which produces an image, taking the R G B channels from one image and getting the A channel from the R channel in another image. There's just one downside- the red channel is actually the worst channel you could possibly pick for this task, and since you're going to be wasting the G and B channels anyway (being duplicates of R) why not use that duplication to recover some of the lost quality?

My suggestion is to do a little more work and put the R and G channels in the RB and G channels of one image (in other words, the R channel is duplicated in the R and B channels) and the B and A channels in the G and RB channels of another image (in other words, the A channel is duplicated in the R and B channels) I found I was able to get equivalent visual quality with lower quality settings. You can use matrices and im.Composite to mash the two images together (use 0.5 0.0 0.5 in the matrix to take the average of R and B channels for the respective result channel).

Alternatively, use a PNG for the alpha layer in your image! PNG doesn't make the red channel look awful unlike JPEG- and your alpha layer is generally huge patches of fully opaque or fully transparent, with a short fading gradient between the two- perfect use for PNG.

EDIT:
SundownKid wrote:You should use TinyPNG instead. https://tinypng.com/ It does image compression without ruining the image like saving it in jpeg does. And it has a comparable file size to a JPG file.
Please do not do this.

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Reduce filesize of images, pictures, etc.

#10 Post by AxemRed » Sat Apr 26, 2014 9:35 am

You shouldn't have to fiddle with JPEG color channels -- just use greyscale JPEGs to store the alpha (and use the JCC script if you're doing this with Ren'Py). That said, a greyscale PNG will still be of comparable or sometimes even smaller size (and without the risk of compression artifacts in your alpha channel).

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Reduce filesize of images, pictures, etc.

#11 Post by Asceai » Sat Apr 26, 2014 9:42 am

AxemRed wrote:You shouldn't have to fiddle with JPEG color channels -- just use greyscale JPEGs to store the alpha (and use the JCC script if you're doing this with Ren'Py). That said, a greyscale PNG will be of comparable or sometimes even smaller size (and without the risk of compression artifacts in your alpha channel).
Yeah, my proposal is an alternative to doing that. I acknowledge that this is the existing approach, I'm just suggesting something different that I personally find works better, even though it is a little more complex. I did this mostly because of artefacts in the alpha channel.

Some other tips (probably more practical than screwing around with JPEG channels =P) for reducing file size:
  • If your font is megabytes in size, it may be because it contains a large number of characters (sometimes a substantial portion of Unicode), and if you're just working in English or with another alphabet that is mostly Latin, you might be wasting a heap of space on characters you don't need. There are font optimizers that can handle this, or you may be able to find a Latin-1 subset of the font you're using.
  • Look at the image manipulators listed in the documentation. Image manipulators are great, because the operation is only performed the first time and whenever the image disappears from the image cache, rather than every frame, so they're basically just as good as standard images, except you don't need to store them on disk. If you're storing multiple versions of certain images, some may be just a simple image manipulator transform away from the another. While night scenes typically warrant separate PNGs, you might be able to manage morning and afternoon with im.matrix.tint. Other scenes may just be a small variation on another scene, which you could approximate just by cutting out everything except the part that changes, saving the image as a transparent PNG and then im.Composite-ing it over the original version.
  • Ogg Vorbis files can be encoded with a whole range of quality settings, and the quality setting you need depends on the music. If you're serious about reducing file sizes I'd try encoding your background music with a bunch of different quality settings and determining by ear (hoping you have a good ear and reasonable sound equipment) the minimal quality setting to use. This may differ per track!
    Voices, thankfully, don't tend to differ as much but sample a few, do the same thing and work out the quality setting to use, then use this for all your voices. This is significant because voices can use a good proportion of your file size, if you use them.

User avatar
Friar Tuck
Newbie
Posts: 11
Joined: Sat Apr 26, 2014 1:10 am
Projects: The Clockwork Diary with Copper Clasps
Contact:

Re: Reduce filesize of images, pictures, etc.

#12 Post by Friar Tuck » Sun Apr 27, 2014 4:31 am

Some tools, fast and easy - fotosketcher (http://www.fotosketcher.com/) and Aimp (http://www.aimp.ru/index.php?do=lang&lng=en). Batch prosessing include.

User avatar
KiloTango
Regular
Posts: 138
Joined: Thu Mar 06, 2014 9:12 am
Projects: The Lighthouse (NaNoReNo14)
Organization: Starship ★ Palindrome
Location: UK
Contact:

Re: Reduce filesize of images, pictures, etc.

#13 Post by KiloTango » Mon Apr 28, 2014 9:41 am

If you use photoshop and can afford it, as well as being brilliant for exporting in general, PNG Hat can really knock down your transparent file sizes by using actually GOOD compression, and being able to make png8s not look awful. (It's worth it for the multi-size, cropped export abilities anyway though)
ImageImageImage

User avatar
Sorakun
Regular
Posts: 103
Joined: Sun Oct 20, 2013 10:02 pm
Completed: Techno Titans, Blood Metal Exorcism, Tom Cruiser, Mechadin, UPlay
IRC Nick: Sorakun
Skype: sora.ch4n
Contact:

Re: Reduce filesize of images, pictures, etc.

#14 Post by Sorakun » Wed May 07, 2014 10:28 am

If you are using a direct X supported engine, you should just use .dds format instead as it is much smaller than its fellow types, unfortunately it is only support with windows as far as i am aware.

Post Reply

Who is online

Users browsing this forum: No registered users