Suppose you have a .jpg photo such as this apple:
You use GIMP to add an alpha channel and remove the white background. As .jpg does not support transparency (see this question), you have to export as a .png file (90KB).
The photo is meant to be used on a webpage or in a (LaTeX) document, and you do not which to have the increased file size. You open the .png file in GIMP and export it as .png, while selecting a compression level of 9 (the maximum). However, this yields a .png file of 96KB.
-> Why? Is there a way to obtain a .png file arount the original file size of 24KB?
I don't think what you want is possible with an RGBa PNG image. This has little to do with GIMP itself. The problem is that it's a lossless format, so it's always going to be bigger than a corresponding RGB JPEG which is a lossy format that allows you to add compression to keep the file size down.
You might want to consider trying a different format such as WebP. GIMP supports export in that format. It allows you to use lossy compression like a JPEG, but retain the alpha transparency. Essentially WebP is almost like an RGBa JPEG, which is not normally possible.
An example. Here's a WebP image that is around 24kb. I saved this at 100% quality, so compression is minimal. The only downside is that not everything supports WebP - some image sharing sites such as imgur don't. Some older browsers might not support it either.
Here are my WebP export settings
And here is the file size
Broadly, JPEG compression is designed to be good at compressing photographs. PNG compression, besides being non-lossy, is designed to be good at compressing rendered vector graphics; it has algorithms to efficiently compress sharp-edged regions of solid color, gradients, and similar things.
Therefore, you can make an image more PNG-compressible by making it more like vector art. I took your apple and used GIMP's Posterize function (20 levels) to produce this image, which is 28.3 KB after compression:
Another option is dithering, which also uses fewer colors but mixes them in patterns, so there is less visible banding but more speckledness. Dithering is also handled well by PNG as long as the dither patterns are consistent; I chose the “Bayer” dither pattern set in GIMP for this image, 20.6 KB:
In both cases, you can choose the number of colors to reduce to and get a larger or smaller image.
I was able to reduce the size even further using the
pngcrush tool, to 14.6 KB. This image is visually identical to the previous, but even smaller, because
pngcrush -brute will try harder than GIMP does (at the cost of spending several seconds finding the best compression strategy).