You get a PSD template from your friends or coworkers. This .psd file is very large. Open it in Ps, check the file info, and you will find there are many lines of "DocumentAncestors" metadata. This is because of the recorded "copy-and-paste-or place" operations. To reduce the file size, you need to remove the "DocumentAncestors" metadata. Today, I will show you 3 ways to eliminate this metadata.
Way 1. Use a .jsx file to remove the "DocumentAncestors" metadata
- Copy and paste the code lines below into a plain text file, save the text file, and change the extension to .jsx.
- Open the PSD file in Ps. Go to "File"->"Scripts"->"Browse" to open this .jsx file. The "DocumentAncestors" metadata will be removed.
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();
If you have many PSD files to be processed, this method is tedious to remove the metadata from each file. In this situation, you can record an action to run this script and use the "Batch" function to batch process PSD files in Ps. Please read this article "How to batch add strokes to images in Photoshop" to take it as a reference.
Way 2. Use "exiftool.exe" to remove the "DocumentAncestors" metadata
You can take advantage of a command-line tool to remove the "DocumentAncestors" metadata from a couple of PSD files at the same time.
- Go to the official site of this tool and download the .zip file. to your Windows computer.
- Extract "exiftool (-K). exe" and rename it to "exiftool.exe".
- Create a .bat file. Type the command line exiftool -r -overwrite_original -XMP-photoshop:DocumentAncestors= 'the path to the file or folder' in a text file, save the text file, and change the extension to .bat. For example, you can type exiftool -r -overwrite_original -XMP-photoshop:DocumentAncestors= 'D:\images' or exiftool -r -overwrite_original -XMP-photoshop:DocumentAncestors= 'D\1.jpg'.
- Put the .bat file and "exiftool.exe" in the same folder. Run the .bat file to remove the metadata.
Way 3. Copy and paste layers in Ps to a new file to remove the metadata
- Open the PSD file in Ps. Press the "ctrl" key and hold down it. Select the layers you need. Right-click on the selected layers and choose "Duplicate Layers". The "Duplicate Layers" dialog box will show up.
- In the "Duplicate Layers" dialog, open the "Document:" drop-down menu and choose "New".
- Type words in the "Name:" field and click on "OK".
- A new PSD file will appear. Save this new file. Check the file info and you will find the "DocumentAncestors" metadata has been removed. Besides, the data about "Saved" in the original file are also removed.
Conclusion
It is necessary to shrink the inflated PSD template, of which the big size is caused by the "DocumentAncestors" metadata. This article shows 3 ways to erase such metadata. If you discover other nice ways in the future, please let me know by leaving your comment below.
Recommended Reading
How to solve "Windows Photo Viewer can't display this picture"
How to remove an event log under "Applications and Services Logs"