This website contains various projects I have worked on. Currently, this includes JavaScripts for Adobe applications and general produciton tutorials using Adobe Creative Suite applications. All projects can be accessed from the right-hand menu.

image of a notepad
Mass flattening images in Photoshop

Script Description

This script allows you to flatten all the documents open in Photoshop at once.

Looking at the script

The script first checks to see if there are any open documents. If there aren't, then the script displays an alert. If there are open documents then it will loop through all of them flattening the files as it goes.

// This script will flatten all open documents in Photoshop

// ensure that there is at least one document open; if not, display error message
if (documents.length == 0) { alert("There are no documents open.");	}

else {
	
	myTotalDocs = (documents.length - 1);


	for ( i = 0;  i <= myTotalDocs;  i++ )  //This loop will keep pages in order, with the last page on top
		{
			myDocument = app.documents[i];
			app.activeDocument = myDocument;
			myDocument.flatten();
		}

}

Installing the script

Installing this script, or any Photoshop script is really easy. Just place the .js or .jsx file into the scripts folder within your Photoshop application folder. Such as, C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts. You may need to restart the application to see the script.

Download the MassFlatten Script


back to top

Image of a notepad

Table-of-Contents

Script files


Other Projects:

Adobe JavaScripts ↑↓

Adobe Creative Suite Tutorials ↑↓



Do you often have many images you need to flatten all at once?

Yes.
No.
I do now!