Menu Close

Saving

Before we start with the theory, I'd like to remind you that the sharpening and saving action pack is available in the shop, and it's free for everyone. It covers most of the saving situation in our line of work.

When it comes to saving images, we know we’re close to the finishing line. Saving is the last step of retouching, and an important one. Sometimes you can ruin all your work by messing up the saving process, so make sure that you fully understand what’s going on in order to avoid any problems. What kind of problems do we usually face in product image retouching, when it comes to saving?

Let's start with the naming problem. In catalogue retouching, we have to preserve file names or/and folder names most of the time. The images must be identifiable, as they represent some products, and after the images get uploaded on the website, they have to match the respective products. When we save images we need to make sure that their names are intact if the image names are used to identify the products, same with the folders if the folder names are important, or both. It depends on the website engine, how it treats the incoming images. Anyway, for now, just keep in mind that we shouldn’t make any changes in any names when we save images.

Saving hi-res images as backup

As the course is almost ended, at this point you should be pretty comfortable with the idea of non-reversible fast-as-hell image retouching. But that doesn't mean we should despise reversibility – on the contrary, we should use it to our advantage.

It really happens sometimes that we have to make changes to our images. And as it might be time-consuming, why not save ourselves some time and use some backup instead of starting all over again every time? Sure thing. There's one very important step in product image retouching that instantly and inevitably limits all possible retouching techniques that can be used on it without ruining the image.

This step is reducing the image size. Before that, you can transform, liquify, color correct with curves or levels, even stretch a bit. After that – not so much. So if you want to be able to fix the image without retouching it from scratch, save a hires right before reducing its size in pixels.

You can add a saving step at the beginning of your size reducing or aligning action, right after flattening, and it will save you hires images. A jpeg hires, especially when isolated, doesn't weigh much, and you can easily store a thousand or two of them without risking to run out of space on your hard drive. And if something goes wrong with the final images, working with half-done hires images will save you quite some time.

Saving a Jpeg multiple times

If you save a jpeg, then open it and edit it and save again, the quality will degrade. If you do it just once or a couple of times, it's not a big deal, but repeated resaving can really destroy your images. There's nothing you can do about it, just keep it in mind. If an image has any smooth gradients, its quality will degrade drastically, while textured images will not change so much. I've run a few tests to see how exactly jpegs behave when being repeatedly resaved and I'm ready to show and explain the results.

One of the cookie images was opened and resaved with the maximum possible jpeg quality exactly 10 times. But the difference between the original image and the resaved version is not that evident. If you darken both images with the same curve and look closely at the upper left corner, the artifacts will become more visible. The reason why it didn't change so much is that the image is textured, even the background is grainy. But don't get all excited yet. Look what happens to smooth gradients.

After being resaved 10 times with maximum quality, the smooth gradient turned into a set of colored bands. You can now see edges where smooth transitions should be instead. The same will happen to more or less smooth backgrounds if you don't isolate them. Fortunately, solid colors do not get affected.

10 times is a lot of resaving. A well-maintained retouching process doesn't require you to do anything like that. But jpeg format still restricts us from being able to change images significantly, as when you have a low-res jpeg, you can really do much to it without causing a serious quality degradation. That's why no one who works in serious heavy-duty fashion or beauty retouching, no one uses jpegs until the very end if using the compressed format at all. But we're in catalogue retouching, and it makes things different. The images we make are not supposed to be significantly changed after saving them for the first time. Minor changes that we might make, like removing some dust, or darkening a bit, are not that harmful if you do it gently and once. Just remember, that you can't play around with your images when they are low-res jpegs.

Saving via scripts

Why can’t Photoshop just save jpegs properly all the time without adding a “copy” to the end of the file name or popping up annoying windows? Well, sometimes it just can’t. If your image has anything like layers or alpha channels or is in 16-bit mode, you won’t be able to simply save as jpeg. How can we avoid that? Of course, you can just delete all the alpha channels and flatten first and make sure that you work with 8-bit images, but it’s not as easy as it sounds. Flattening is easy, okay, you can put it in an action and it will work fine no matter how many layers your image has when you run it. But if you try to delete alpha channels with an action, you will realize that it will only work if the image has an alpha channel with a name specified, and if it doesn’t, you will get an error. This seriously complicates the process of saving. How can it be fixed?

The answer is easy: by scripting. Don’t save with actions, use scripts instead and you’ll be fine. By now you should already be familiar with simple scripting, so now I’ll tell you how to solve the problems that arise when you try to save images that have layers or alpha channels to jpegs. All you need is use these two commands:

app.activeDocument.flatten();
app.activeDocument.channels.removeAll();

The first one flattens your document, and the second one removes all the alpha channels if there are any. You can save paths in jpegs, but it's still a good idea to remove them when saving – who needs paths anyway? Especially if it's a lonely point placed by mistake. This, of course, is optional.

app.activeDocument.pathItems.removeAll();

The next problem is preserving the file names and folder structure. There are three situations that are most applicable to the catalogue retouching process. Let’s discuss them all. The first one is when you have a lot of images, all in one folder, and you do not want to create any additional images or folders. So you want to resave them, which is the same as hitting the Save command instead of Save As. But if you try to do it in Photoshop, it will most probably display the Jpeg Options panel where you’ll have to choose the compression level and other options. This is not cool, as any panel popping up into view when you don’t need one is annoying. But if you manage to write an action that uses the Save command, it will probably work fine unless you try to save alpha-channels or layers, in which case the Save As panel will emerge and offer you to save a copy of the image.

To avoid all the possible panel encounters, let’s just write a script that will save without asking anything. How to do it? Well, the most simple option consists just of three lines:

app.activeDocument.flatten ();
app.activeDocument.channels.removeAll();
app.activeDocument.save();

But this is not a good option. The save() method doesn’t take any parameters, so how can Photoshop find out which jpeg saving parameters to use? Well, that’s easy. It just uses the last parameters you entered intentionally. It means that if you saved some jpeg manually and entered 1 as quality, next time you use the save() method it will save the image with low quality without any prompting, which is absolutely not tolerable in product image retouching, so we need to specify how exactly we want our images to be saved.

I’ll assign a variable named doc to app.activeDocument, so the next time I want to address the image I can just use doc, which is much shorter and easier to write. Then I'll tell Photoshop to flatten and remove all alpha channels from this document, as I’m going to save it in jpeg. And why not check for size while we’re at it? If the size is wrong, the script should alert the user instead of saving. Let’s do it.

I’ll switch the units to pixels in case it’s set to inches or something else, which will mess with our image size. But I'll also save the units settings so that I can change my settings to the original settings in the end. It's not really polite to mess up users' setting without at least asking.

var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;

Then I’ll assign the desired width and height of our image to 1000 and 1500 and call these variables “w” and “h” to make it short. These numbers can be changed to any numbers fitting. If they do not match the image, we’ll make the script stop itself from executing.

var w = 1000;
var h = 1500;

Then I’ll add a conditional so that when the script runs, it will check if the image size is correct. And if it’s not correct, I’ll make the script tell us which size is correct. If it is correct, the script will remove alpha channels or layers if there are any and save a jpeg in the same location with the same filename. Here’s the full text of the script.

var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument
var w = 1000; // put your desired image width here – if not correct, will not save
var h = 1500; // put your desired image width here – if not correct, will not save
if (doc.width == w && doc.height == h) {
doc.flatten();
doc.channels.removeAll();
doc.pathItems.removeAll();
saveFile = new File(doc.path + '/' + doc.name);
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 12;
doc.saveAs(saveFile, saveOptions, false, Extension.LOWERCASE);
} else {
alert("Incorrect image size: should be " + w + " px wide and " + h + " px high", "MindfulRetouch.com");
}
app.preferences.rulerUnits = startRulerUnits;

That’s it, now all we have to do is to record an action and make it run the script, and it will save the images without any problem. In this case, if you have the original images located and named like this:

C:\IMAGES\IMAGE1.JPG
C:\IMAGES\IMAGE2.JPG

The result will be the same:

C:\IMAGES\IMAGE1.JPG
C:\IMAGES\IMAGE2.JPG

Remember, as this script works with the file and folder names, it cannot be used on images that had not been saved yet. So if you make a new document called Untitled-1 and try to run the script, you’ll get an error. If you don't want the script to check image size, here's a simplified version:

var doc = app.activeDocument
doc.flatten(); //flattens all layers
doc.channels.removeAll(); //removes alpha channels
doc.pathItems.removeAll(); //removes paths and points
saveFile = new File(doc.path + '/' + doc.name); //resave at the same destination
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 12;
doc.saveAs(saveFile, saveOptions, false, Extension.LOWERCASE);

But what if we need to save the images in a separate folder? This is the second possible option, and it’s also scriptable. This time the images will be saved in a subfolder named DONE. So if you have the original images like this:

C:\IMAGES\IMAGE1.JPG
C:\IMAGES\IMAGE2.JPG

The result will be

C:\IMAGES\DONE\IMAGE1.JPG
C:\IMAGES\DONE\IMAGE2.JPG

But if you work with saved images that are located in a DONE folder already, they will not be put in any other subfolders, they will be re-saved instead. The script checks if the file located in a DONE subfolder before creating any subfolders, so you cannot get anything like

C:\IMAGES\DONE\DONE\IMAGE1.JPG

There will only be one DONE subfolder, no more. Now, as this is not a programming course and you must be pretty tired already with all the javascript coding, I’ll just give you the script text. But I cannot avoid mentioning programming as I’m talking about scripts, as it’s very important to understand how it all works.

So, here’s the text of the script that saves images to subfolders.

var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument
var w = 1000; // put your desired image width here – if not correct, will not save
var h = 1500; // put your desired image width here – if not correct, will not save
if (doc.width == w && doc.height == h) {
if (doc.path.name.lastIndexOf('DONE') != -1) //if the file IS in DONE subfolder already, resave
{
saveFile = new File(doc.path + '/' + doc.name);
} else {
savefolder = new Folder(doc.path + '/DONE/');
savefolder.create();
saveFile = new File(savefolder + '/' + doc.name);
}
doc.flatten();
doc.channels.removeAll();
doc.pathItems.removeAll();
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 12;
doc.saveAs(saveFile, saveOptions, false, Extension.UPPERCASE); //change to UPPERCASE if you want .JPG instead of .jpg
} else {
alert("Incorrect image size: should be " + w + " px wide and " + h + " px high", "MindfulRetouch.com");
}
app.preferences.rulerUnits = startRulerUnits;

Once again, if you don't want the script to check the image size, you can use the simplified version below. It will just flatten, remove channels and save to a subfolder.

var doc = app.activeDocument; {
if (doc.path.name.lastIndexOf('DONE') != -1) //if the file IS in DONE subfolder already, resave
{
saveFile = new File(doc.path + '/' + doc.name);
} else {
savefolder = new Folder(doc.path + '/DONE/');
savefolder.create();
saveFile = new File(savefolder + '/' + doc.name);
}
doc.flatten();
doc.channels.removeAll();
doc.pathItems.removeAll();
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 12;
doc.saveAs(saveFile, saveOptions, false, Extension.UPPERCASE); //change to UPPERCASE if you want .JPG instead of .jpg
}

Now let’s talk about the third situation, that is also possible in catalogue retouching. Sometimes you have to work with images that are not located in a single folder, but spread in many folders, and each folder name contains the same product name. Like this:

C:\IMAGES\PRODUCT1\PRODUCT1_1.JPG
C:\IMAGES\PRODUCT1\PRODUCT1_2.JPG
C:\IMAGES\PRODUCT2\PRODUCT2_1.JPG
C:\IMAGES\PRODUCT2\PRODUCT2_2.JPG

And in the end, you want all these folders with their respective images to be saved while preserving the folder and file structure, like this:

C:\IMAGES\DONE\PRODUCT1\PRODUCT1_1.JPG
C:\IMAGES\DONE\PRODUCT1\PRODUCT1_2.JPG
C:\IMAGES\DONE\PRODUCT2\PRODUCT2_1.JPG
C:\IMAGES\DONE\PRODUCT2\PRODUCT2_2.JPG

Same as before, the script checks if the image size is correct, then it checks if the image is located in a folder named DONE already or not, and then it either re-saves or saves into a DONE folder. Here’s the text.#

var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument
var w = 1000; // put your desired image width here – if not correct, will not save
var h = 1500; // put your desired image width here – if not correct, will not save
if (doc.width == w && doc.height == h) {
if (doc.path.parent.name.lastIndexOf('DONE') != -1) //if the file IS in DONE subfolder already, resave
{
saveFile = new File(doc.path + '/' + doc.name);
} else {
savefolder = new Folder(doc.path.parent + '/DONE/' + doc.path.name);
savefolder.create();
saveFile = new File(savefolder + '/' + doc.name);
}
doc.flatten();
doc.channels.removeAll();
doc.pathItems.removeAll();
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 12;
doc.saveAs(saveFile, saveOptions, false, Extension.LOWERCASE); //change to UPPERCASE if you want .JPG instead of .jpg
} else {
alert("Incorrect image size: should be " + w + " px wide and " + h + " px high", "MindfulRetouch.com");
}
app.preferences.rulerUnits = startRulerUnits;

And here's a simplified version that doesn't check for the image size:

var doc = app.activeDocument
if (doc.path.parent.name.lastIndexOf('DONE') != -1) //if the file IS in DONE subfolder already, resave
{
saveFile = new File(doc.path + '/' + doc.name);
} else {
savefolder = new Folder(doc.path.parent + '/DONE/' + doc.path.name);
savefolder.create();
saveFile = new File(savefolder + '/' + doc.name);
}
doc.flatten();
doc.channels.removeAll();
doc.pathItems.removeAll();
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 12;
doc.saveAs(saveFile, saveOptions, false, Extension.LOWERCASE); //change to UPPERCASE if you want .JPG instead of .jpg

While the three scripts I’ve written cover most of the saving situations in catalogue retouching, I can easily imagine a situation where you might need something else, like another saving location or another file type. But I will not be able to explain all the possible saving options as there are too many, and you can rewrite the scripts I provided or ask for help if it seems too difficult.

When you work with images, make sure you don't put them in the root directory of your hard drive, like C:\ for Windows users. You won't be able to save files with the procedure I described before due to a bug. Put them in any other folder and you'll be fine.

Next: Saving quality

Top

On this website, we use first or third-party tools that store small files (cookies) on your device. Cookies are normally used to allow the site to run properly (technical cookies), to generate navigation usage reports (statistics cookies) and to suitable advertise our services/products (profiling cookies). We can directly use technical cookies, but you have the right to choose whether or not to enable statistical and profiling cookies. Enabling these cookies, you help us to offer you a better experience. If you choose to disable cookies, you won’t be able to watch the embedded videos. Cookie policy