Now it works, I just delete the first jpgSaveOptions.embedColorProfile = true;
var JPGquality = 12;
var docPath = '/Users/cristianmoisei/Desktop/';
var docName = app.activeDocument.name.replace(/\.[^\.]+$/, '');;
var saveFile = new File(docPath + '/' + docName + '.jpg');
var fileExists = saveFile.exists;
var tries = 1;
while (fileExists) {
saveFile = new File(docPath + '/' + docName + ('-' + tries) + '.jpg');
tries++;
fileExists = saveFile.exists;
}
SaveJPEG(saveFile, JPGquality);
function SaveJPEG(saveFile, jpegQuality) {
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality; //1-12
activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
}
Here is my process:
- Having a jpg with Adobe RGB (1998) profile
- Change it to Don't Color Manage This Document
- Save the file
- Play the script
- When opening the duplicate file, the profile is Don't Color Manage
This Document

This is another script to try (source feedback.photoshop.com/photoshop_family):
//Duplicate doc
var doc = app.activeDocument
var fname = doc.name.split(".")
var fname = fname[0]
//var newDoc = doc.duplicate(fname) // This caused active document to be in an
unsaved state and have no document path
//save part
if (app.documents.length > 0) {
var thedoc = app.activeDocument;
var docName = thedoc.name;
if (docName.indexOf(".") != -1) {
var basename = docName.match(/(.*)\.[^\.]+$/)[1];
} else {
var basename = docName;
}
//getting the location, if unsaved save to desktop;
try {
var docPath = doc.path;
} catch (e) {
var docPath = "~/Desktop";
}
var docFolder = Folder( doc.path );
var newFolder = Folder( docFolder.parent + '/' + "02 - web");
// create folder if missing
if (!newFolder.exists) {
$.writeln("Creating new folder: " + newFolder.fsName)
try {
if( newFolder.create() === false )
{
alert( "error:copyDir:error creating directory "+newFolder.fsName);
}
} catch (e) {
alert( "error:copyDir:error creating directory "+newFolder.fsName+":"+ e.message);
}
}
var jpegOptions = new JPEGSaveOptions();
jpegOptions.quality = 12;
jpegOptions.embedColorProfile = true;
jpegOptions.matte = MatteType.NONE;
var filename = newFolder + '/' + basename + '.jpg';
$.writeln(filename);
thedoc.saveAs((new File(filename)), jpegOptions, true);
};