Skip to main content
Inspiring
December 12, 2020
Answered

Calculating file size

  • December 12, 2020
  • 1 reply
  • 3999 views

I have a client request for a file to be 50-60MB (8 bit rgb uncompressed Tif)

 

For some unknown reason which hasn't happened before, I am having a little difficulty understanding & calculating file size while preparing 8bit Tif files to fall within the 50 to 60mb range.
 
The confusion arises because the listed file size differs depending on whether I view the image in Photoshop, as a Bridge thumbnail, or in the Finder (via Get Info).  See attached screenshots.
They differ, I think because one is reading the image pixels and the other is reading the storage space on the hard drive. But I'm ot sure why they're different.
 
A third size appears when I apply the following formula/calculation
Total number of px (WxH) x Bit depth (8 or 16) ÷ 8 (for Bits) ÷ 1024 (for Kb) ÷ 1024 (for Mb)
 
For example -
An image is 5000px x 3750px = 18,750,000 total pixels
Multiply by 8 bit depth = 150,000,000 bits
Divide by 8 for size in Bytes = 18,750,000 bytes
Divide by 1024 for size in Kilobytes = 18310 kb
Divide by 1024 for size in Megabytes = 17.89 MB
 
So I have different sizes - this one is 17.89, Photoshop>Image Size is 53.6M, Bridge is 71.28, andt the Finder>Get Info is 74.7 M
Which is it
This topic has been closed for replies.
Correct answer JJMack

https://www.dropbox.com/sh/l8hl9gqapf2u9lj/AACIW9ZOIuGWr18WOIssbZefa?dl=0


It turns out you saved your TIFF file with the option Save Image Pyramid  checked .That added the extra 20MB of data in the tiff files].

 

1 reply

JJMack
Community Expert
December 13, 2020

File size is Mostly Pixel Data plus a little bit of meta data. So if you want an Uncompressed Tiff you cans calculate the Pixels data  and guess at the size of meta data . A RGB pixels requires 8bits for Red, 8bits for Green, and  8bits for Blue.  5000px x 3750px x 3 = 56,250,000 Bytes Dec.   Using 1024 as 1K computed  1024 for M  the works our the 53MB  for pixel data. So for a Flat Tiff the file size should be 53 Computer MB  Plus meta data size.. If the File is 74MB the file is either a layered document or there is a lot of Ancester metada which you can strip.

 

function deleteDocumentAncestorsMetadata() {  
    whatApp = String(app.name);//String version of the app name  
    if(whatApp.search("Photoshop") > 0)  { //Check for photoshop specifically, or this will cause errors  
        //Function Scrubs Document Ancestors from Files  
        if(!documents.length) {  
        alert("There are no open documents. Please open a file to run this script.")  
        return;   
        }  
        if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");   
        var xmp = new XMPMeta( activeDocument.xmpMetadata.rawData);   
        // Begone foul Document Ancestors!  
            xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "DocumentAncestors");  
            app.activeDocument.xmpMetadata.rawData = xmp.serialize();  
         }  
}  
//Now run the function to remove the document ancestors  
deleteDocumentAncestorsMetadata(); 

 

JJMack
Inspiring
December 13, 2020

Thank you for this.

 

The formula for pixel data size is:

 W px x H px x3 (rgb) ÷1024 (= kb) ÷ 1024 (= mb) 

In this example, 5000px x 3750px x 3 = 56,250,000 bytes ÷ 1024 = 53941÷ 1024 = 53.6 MB

 

The file is flattened and no Layers or Channels.

So when Bridge and/or the Finder show the size as being larger it could be Metadata info added on top of the px data size ?

Could it be anything else?

 

To strip the Metadata, I am not familiar with running Scripts, but I guess I can try and open the Terminal and copy/paste the above.

Is there a way to automate the process, or create an actio,n or perhaps there is a small and simple plug-in or app (Mac OS 10.15 Catalina) to strip Metadata?

 

Thanks again.

 

 

 

Inspiring
December 13, 2020

 

I googled and found that the free app ImageOptim will do just that but unfortunately it only works with Jpegs , png etc Not with Tifs