Copy link to clipboard
Copied
I have a client request for a file to be 50-60MB (8 bit rgb uncompressed Tif)
1 Correct answer
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].
Explore related tutorials & articles
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();
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.
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
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.
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.
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.
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.
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?
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.
Copy link to clipboard
Copied
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].
Copy link to clipboard
Copied
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.

