Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some XCF and PNG exports are bloated
#1
I'm using 2.10.24 Yesterday after importing 73 meg PNG file into GIMP the XCF file became really bloated -  698 meg and the PNG I exported from this was 397 meg. I think the reason this is occurring is sometimes some pics are too small so I need to scale the layer much higher, sometimes over 100,000 px. Does scaling increase the file size quite a bit? 

When this occurs GIMP is super slow at saving the file or exporting a file.  Recently when this happened I noticed that most of the files I've been creating lately, which are all similar faces swaps, are fairly small XCF files (5-100 meg) and small PNG's (1-35 meg)  are created from the export.

I use Photo Gallery to view my pics and want them to be about the same size for a slide show. After I make changes in GIMP I always open the pic in PhotoWorks, which is a program with some time saving photo correction and altering tools. I then save as a PNG and I open it again in GIMP for final fixes.

As a temporary fix I used the Snipping Tool to create a new PNG file from the  397 meg and it's a small 682 KB PNG file - 500x smaller

I think the PNG file somehow got corrupted. Is there a way to fix a file that opens in GIMP but is corrupted in some way?  or do I just need to use the Snipping Tool? Or can the export the scale the pic larger?
Reply
#2
If you create an image with a side of 100000px the resulting file is going to be huge.

The PNG compression algorithm is quite slow. The PNG export file dialog allows you to set a compression level, the default "9" is slow and not much gain in file size over lesser levels, especially if the image is a photo. Try a level 5 or below.

Quote:sometimes some pics are too small so I need to scale the layer much higher
You may want to tell us what the real problem is because there is usually no real reason to create images that big, so you are likely trying to fix the wrong problem.
Reply
#3
My take on it.

Quote:...snip..Does scaling increase the file size quite a bit? ..

Of course it does. Gimp is a raster (bitmap) editor where the images is composed of rectangular pixels. A 20 x 20 image = 400 pixels, Scaling x2 and while most people think in linear units that gives a 40 x 40 image = 1600 pixels a four times increase in size.

Then there is compression. Although png is lossless it is compressed, the default is maximum compression. A 400 x 400 one layer with a single colour, file size 1 KB , filled with a multicolour gradient, file size 48 KB

Then bit depth, I managed to find a 72 MB 8 bit RGB PNG, a nice colourful old map about 6400 x 5600 pix That is reported bottom of the Gimp window as 336 MB That is memory used by Gimp not file size , the value will swell with add layers, undo information held by Gimp.

Without any scaling the exported file size will increase (1) Add an Alpha Channel 72 MB -> 81 MB (2) Increase the bit depth File -> Precisionabove 8 bit , export and get a 16 bit image file = 112 MB

In Edit -> Preferences -> Image Import & Export -> Import Policies there is an option to both increase bit depth and add an alpha chanel automatically. Check that.

I can go the other way, export as grayscale = 24 MB or convert to color indexed (256 colours) 2.5 MB. Beware of programs that give small png files, they might be indexed.

Gimp .xcf saved files are roughly parallel, although larger, internal compression is not as great. Any extra layers, masks, channels all contribute to the file.

Quote: As a temporary fix I used the Snipping Tool to create a new PNG file from the 397 meg and it's a small 682 KB PNG file - 500x smaller

AFAIK snipping tool = screen capture, bound to be smaller, the image size width x height is limited by monitor size, what you get is a scaled down image.
Reply
#4
Great advice. I think the problem is the Photoworks program I'm using to tweak the pics. I've noticed getting a message sometimes about it needing to reduce the size of the pic or something like that. And then when I go back to GIMP I have to scale the size up. 

I'm going to start watching more closely the size of the XCF files and the PNG files that both programs are creating. Next time I start running into a problem I'll just use the Snipping tool to make a PNG unless there's a better way of doing this. 

Can GIMP or another program fix a problem like this when the PNG that I import into GIMP is really bigger than it should be?

What is the purpose of compression in exporting a PNG file? Is it simply to make the file size smaller making it easier to email or save HD space? If so, neither of those are issues for me and I can either skip compression or reduce the 9 default to 5 or less as suggested.

Next time I feel like I need to scale something even close to 100,000 px, I'll stop and redo something. Most of the pics I start with are JPG files ranging from 45 KB to 2,700 KB

So far the only XCF file I've had that's been this huge problem is this XCF I mentioned  - 698 megs and the exported PNG 397 megs. The PNG I imported into GIMP that created this mess was 71 meg, which is far bigger than my typical range of 200 KB to 20 meg and this 71 meg file either won't open in Photo Gallery or is extremely slow. Maybe it's a corrupt file.

In the future I plan on changing the Preferences like Rich said and using less compression for the PNG exports.
Reply
#5
(06-14-2021, 01:47 AM)GMP Wrote: I think the reason this is occurring is sometimes some pics are too small so I need to scale the layer much higher, sometimes over 100,000 px.
Um... I cannot see any reason to increase the size of a "normal" (4 or 6K even 8K) pic to 100 000 px or more... that would give a lot of garbage pixels wise, and if 1 pixel = 1 mm, that would give an image of around 100 metre to print (~100 yards) unless you want a GIGA-ENORMOUS picture to put on the widest building near-by...
so what do you mean exactly by "some pics are too small" to increase them to a 100K image?
Just to be sure, do you use the Zoom tool (Ctrl + Mouse wheel over the picture) if the image appears too small in GIMP?
Reply


Forum Jump: