• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Calculating file size

Contributor ,
Dec 12, 2020 Dec 12, 2020

Copy link to clipboard

Copied

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

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 13, 2020 Dec 13, 2020

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].

image.png

image.png

 

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 12, 2020 Dec 12, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

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.

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

Adobe install some Photoshop scripts when It install Photoshop. They are text files in Photosho's folder Presets\Scripts  all the script Adobe installs are scripted with JavaScript code. So they work on both platforms. Photoshop's ScriptingSupport Plug-in supports three scripting language  Apple Script,  Mac only. VBS Pc only and JavaScript   File Names  are Script Name with the extension ,jsx for JavaScript names like  "Image Processor.jsx" and you  use them via menu File>Scripts>ScriptName,,, where there may or not be the ",,," if there the script will be interactive that is have a dialog.  

 

What I posted is a JavaScript.  Save that code into a Text file name "DeleteAncestorData.jsx" in Photoshop's folder Presets\Scripts.   With your document open in Photoshop then use menu File>Scripts>DeleteAscestorData It will not strip all Meta Data  it just remove the bulky ancestor data.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

I copied and pasted all of your code into a TextEdit file and changed the formatting from rtf to plain text and saved it as DeleteAncestorData.jsx (but first it was saved as DeleteAncestorData.jsx.txt so I just deleted the .txt). I copy/pasted it in the Scripts folder & ran it (I did not see any dialog or anything happeneing to confirm success - should there be ?)

 

But still as per my original post the file size shows up correctly in Ps>Image size.

But in Bridge where I have data under the thumbnails it still shows as being larger, and in the Finder>Get info also - see new screenshots below. The files are flattened and no channels.

 

Screen Shot 2020-12-13 at 8.04.26 AM.jpgScreen Shot 2020-12-13 at 8.06.00 AM.jpgScreen Shot 2020-12-13 at 8.06.31 AM.jpg

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

That Script has no Dialog and  put out no message.  When you use if there is Ancestor Data in the documents Meta Date it should be removed.  When you then save the tiff uncompressed it should save as 54MB file if it is not layered. If it is layered there could be a small layer that add 20MB of Pixel data to the mix.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

As you see in the 3 screenshots above, there is still a discrepancy between the file sizes shown for the same file. I tried it with 2 more files.

Even after I ran the script and saved it with no layers (or channels).

The mystery continues...

Thanks anyway for trying to help. Appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

...just one last thing to be sure I'm not missing anything...how do i know when the script is complete, before i save the file. Is it fairly instant?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

It is instant.  Upload the Tiff file to dropbox of google drive and post a linke to it. I'll test it on Windows.

image.png

image.png

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

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].

image.png

image.png

 

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

LATEST

Thank you very much for finding this fault  !

 

You are a digital detective 🙂

 

How or why this 'pyramid' box became checked is a mystery because Ive never had this problem before and I've done a lot of this over the past few years. The only thing different now with these 'tests' is that I am using Save As (with a different filename which I don't usually do). The 'pyramid box' only shows in  the Save As dialog box.

 

My usual workflow is -

I always start with a Raw file in ACR (camera raw) and when I have it processed the way I want it I save it as a 16 bit Tif file and then do final corrections or retouching in Photoshop and save it (still as 16 bit).

When I need to upload or send it to a client or a lab I either Duplicate the file or Copy it to a new folder then change the image mode to 8bit and save it again, so I have not dealt with this Save As with the pyramid options before. This halves the file size e.g 100mb in 16bit becomes 50mb in 8bit.

 

I have looked under preferences & googled but haven't found a way to have the 'save pyramid' box unchecked/ disabled yet so that it doesnt happen again, by default.

Thanks again for finding the solution to the problem. I appreciate it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines