It is currently Wed Sep 02, 2026 5:31 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: XCF File Size
PostPosted: Sat Nov 23, 2013 10:30 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Aug 30, 2012
Posts: 2174
This is just more curiosity rather than anything else, I noticed that if I look at the properties of an XCF it shows the size as 2.9mb but when I open with Gimp the bottom information bar shows a size of 320mb, just wondered what is the cause of such a huge difference in the values.

_________________
Image


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 11:10 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 590
I allways have noticed the same difference.

_________________
Image


Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 11:25 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Apr 07, 2010
Posts: 14182
@he4rty. I have an XCF I just made. saved it to desktop, in properties it says it is 72.3 KB When I look at the bottom of the opened XCF, it says 2.6 MB. This is strange, but must have a logical explanation from some of these techies out there. :teeth

_________________
Image


Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 11:54 am  (#4) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
The data for all of an image's drawables (i.e., its layers, channels, and layermasks) is divided into 64x64 pixels "tiles". Each of these tiles requires 4096 bytes of memory per component -- for example, a single tile of RGB pixels with an alpha channel requires 16KB of memory in the computer.

However, when these tiles are saved to the XCF file, "run length encoding" is used to reduce the number of bytes that are written to the file. Simply described, run length encoding works by providing a "count" byte followed by a "value" byte; when the file is read, the "value" is repeated "count" number of times. So, for example, if you have a row of black pixels in a tile then instead 64 zeroes being written to the file, only two bytes are written (a "64" followed by a "0"). For longer "runs" of identical values, GIMP allows for the data to be encoded in just four bytes.

At the extreme, a solid-colored layer or channel which occupies several kilobytes in memory only takes up a handful of bytes in the XCF file. Even for layers and channels that contain varying data, run length encoding will typically result in great savings in file space.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 12:02 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
What saulgoode said.
I can only add that for sRGB color space pixel data calculates as follows:
N of layers x W x H x 3 bytes X 4 (for alpha channel) = document size (in session memory size).
So, transparency costs you memory and disk space. Layer masks, selections, etc. also add up to all this.


Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 12:07 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Apr 07, 2010
Posts: 14182
You guys sure know your techie stuff. Image

_________________
Image


Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 12:13 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Aug 30, 2012
Posts: 2174
Thanks for that, I think I've got the gist of what your saying, I guessed it was to do with compression of some kind but wasn't sure how it was compressed so much.

_________________
Image


Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 1:36 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
he4rty wrote:
Thanks for that, I think I've got the gist of what your saying, I guessed it was to do with compression of some kind but wasn't sure how it was compressed so much.


AFAIK, xcf docs are not being compressed, one of the reasons why they are lossless.


Top
 Post subject: Re: XCF File Size
PostPosted: Sat Nov 23, 2013 10:50 pm  (#9) 
Offline
GimpChat Member

Joined: Jul 11, 2010
Posts: 349
K1TesseraEna wrote:
AFAIK, xcf docs are not being compressed, one of the reasons why they are lossless.


Compression does not equal lossless. For example, zip files are compressed but are still lossless.


Top
 Post subject: Re: XCF File Size
PostPosted: Sun Nov 24, 2013 12:39 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Aug 30, 2012
Posts: 2174
Thank you all anyway for the techie stuff, I'm not going to get into a disagreement over my bad choice of words, I'm just not techie minded or just cannot remember all these words and meanings.

_________________
Image


Top
 Post subject: Re: XCF File Size
PostPosted: Sun Nov 24, 2013 12:08 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Aug 28, 2012
Posts: 3060
Location: Idk where I am.
K1TesseraEna wrote:
So, transparency costs you memory and disk space. Layer masks, selections, etc. also add up to all this.

That answers why my XCF's are always huge, thanks. :lol

_________________
Image
Reality is a lovely place...But I wouldn't wanna live there.


Top
 Post subject: Re: XCF File Size
PostPosted: Sun Nov 24, 2013 3:09 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Mokonafan wrote:
K1TesseraEna wrote:
So, transparency costs you memory and disk space. Layer masks, selections, etc. also add up to all this.

That answers why my XCF's are always huge, thanks. :lol


You're welcome Moko!

It's been my habit to add alpha channel to all layers. And this operation itself adds up
to memory size big time. A little experiment. Create a new 1 layer 640x640 px image, filled with BG color (white).
Information panel on the bottom of the gimp window shows the size - 3.9 MB or so.
Add alpha channel in layers panel (right-click->Add Alpha Channel). The size goes up to 5MB.
And this is just one layer on which we haven't really done anything yet.
I have 6 TB of disk space to worry about file size :hehe but if had < 1 TB I'd start panicking.


Top
 Post subject: Re: XCF File Size
PostPosted: Sun Nov 24, 2013 10:39 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
I think I may have to move all my old xcf's to a memory stick, my hard drive isn't even 1 TB.


Top
 Post subject: Re: XCF File Size
PostPosted: Sun Nov 24, 2013 11:29 pm  (#14) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
You can always use gzip or bzip2 to cut the size of your XCFs roughly in half. GIMP is able to handle .xcf.gz and .xcf.bz2 files directly, both in saving and in loading (it just takes longer than using .xcf).

gzip and bzip2 are included in all GNU/Linux distributions. I don't know if Microsoft includes it with Windows, but the 7-zip program handles compression and decompression using both protocols.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: XCF File Size
PostPosted: Mon Nov 25, 2013 4:04 am  (#15) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
saulgoode wrote:
You can always use gzip or bzip2 to cut the size of your XCFs roughly in half. GIMP is able to handle .xcf.gz and .xcf.bz2 files directly, both in saving and in loading (it just takes longer than using .xcf).

gzip and bzip2 are included in all GNU/Linux distributions. I don't know if Microsoft includes it with Windows, but the 7-zip program handles compression and decompression using both protocols.


GIMP on Windows includes bzip2.dll (or bz2-1.dll) and zlib1.dll so handles .xcf.gz .xcfgz .xcf.bz2 .xcfbz2 automatically.

Kevin


Top
 Post subject: Re: XCF File Size
PostPosted: Mon Nov 25, 2013 10:38 am  (#16) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
paynekj wrote:
GIMP on Windows includes bzip2.dll (or bz2-1.dll) and zlib1.dll so handles .xcf.gz .xcfgz .xcf.bz2 .xcfbz2 automatically.

True, yet one of the nice things about GIMP using these freely-implemented standard compression methods is that dedicated tools can be used to compress or decompress multiple files at once (for example, all of the .xcf files in a folder, or all of the original frames from a GAP animation).


@Mokonofan
Roughly speaking gzipping reduces file size by about 40% and takes 3 times as long to load or save, whereas bzip2ing reduces the file size by about 60% and takes 10 times as long to load or save. This is all dependent upon how fast your processor is versus how fast your disk drive is -- if your processor were fast enough then you could compress a file as fast as you save the data and have compression actually improve the transfer speed (saving to a USB pendrive would be a good example of this situation).

Despite the better compression bzip2 offers, you might prefer gzip because decompression can start while the file is transferring (one of the reasons it is so much faster than bzip2). With bzip2 the entire file needs to be loaded before decompression can start. This is especially significant when uploading a file to the Internet because the downloader can start decompressing while the file is downloading. This means that a downloaded gzip file can be ready as soon as the download is complete (whereas at this point a downloaded bzip2 file would just be starting the decompression and a plain .xcf file would still be downloading). In other words, when opening a URL from within GIMP, an .xcf.gz will typically be available for editing much quicker than either an .xcf or an .xcf.bz2

All things considered, my recommendation is to always use .xcf.gz to save your images, except for long-term archiving or when making GAP animations.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: XCF File Size
PostPosted: Mon Nov 25, 2013 11:25 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
IIRC, 2-ton is using MacOS.


Top
 Post subject: Re: XCF File Size
PostPosted: Mon Nov 25, 2013 12:56 pm  (#18) 
Offline
GimpChat Member

Joined: Apr 29, 2013
Posts: 203
2-ton wrote:
I think I may have to move all my old xcf's to a memory stick, my hard drive isn't even 1 TB.

I only has 1.6 GB hardisk space left and I don't worry... :rofl

BTW, is using 'blend' tools seems somehow make .XCF files bigger in size?
I test using default image size a5 300dpi 1754x2480

Black without transparency=18KB (file size on disk)
White without transparency=18KB
Empty Transparency=23KB
Transparency filled with black=23KB
Transparency with 'normal' 50% blend using black color=1708KB
Grey with 'divide' 50% blend=4257KB
Gradient used: FG to transparent

Using example above, after I clear the layer and just transparency left, I notice the file size still at 4266KB (it's an empty layer, just transparency)?
And after I fill it with black, the size become 33KB.
I think 'something' is left untouched by the program, but I'm not sure what...

_________________
~


Top
 Post subject: Re: XCF File Size
PostPosted: Mon Nov 25, 2013 1:05 pm  (#19) 
Offline
GimpChat Member
User avatar

Joined: Aug 30, 2012
Posts: 2174
Thanks for all the info, I never knew this thread would yield so much discussion and advice.

_________________
Image


Top
 Post subject: Re: XCF File Size
PostPosted: Mon Nov 25, 2013 2:04 pm  (#20) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Zeo wrote:
Using example above, after I clear the layer and just transparency left, I notice the file size still at 4266KB (it's an empty layer, just transparency)?
And after I fill it with black, the size become 33KB.
I think 'something' is left untouched by the program, but I'm not sure what...

When you clear a layer, its alpha channel is filled with zero (black) so that it is visibly transparent :geeking however, the values in the red, green, and blue channels are left unchanged. Why waste time changing something that isn't going to be seen anyway?

You can verify that this is what is happening by performing a "Colors->Components->Decompose" to RGBA after clearing your layer.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group