Copy link to clipboard
Copied
I'm trying to make some batch operations on images. All works great, but I noticed that the image name are changed.
When I save my image, if the name contains space, photoshop automatically convert this whitespace to "-". I want preserve my image name, because I have those informations stored in the database and after the change name I cannot find the correct path of the image.
For example an image called "Google Analytics.png" become "Google-Analytics.png" but I DON'T want that extra "-".
This is my script routine:
function SavePNG(saveFile){
var file = new File(saveFile);
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = false;
pngOpts.transparency = false;
pngOpts.interlaced = false;
pngOpts.quality = 100;
app.activeDocument.exportDocument(file,ExportType.SAVEFORWEB,pngOpts);
}
That is controlled by the saveForWeb preferences in Photoshop. As far as I know those preferences can only be changed in the GUI.
With any image open choose File-Save for Web... Then in the flyout menu of the SFW dialog choose Edit Output Settings... In that dialog choose Saving Files from the dropdownlist at the top then uncheck Unix in the Filename Compatibility section. This only has to be done once as the settings are sticky.
Once that setting has been changed your code should export the file
...Copy link to clipboard
Copied
That is controlled by the saveForWeb preferences in Photoshop. As far as I know those preferences can only be changed in the GUI.
With any image open choose File-Save for Web... Then in the flyout menu of the SFW dialog choose Edit Output Settings... In that dialog choose Saving Files from the dropdownlist at the top then uncheck Unix in the Filename Compatibility section. This only has to be done once as the settings are sticky.
Once that setting has been changed your code should export the file without the underscore.
Copy link to clipboard
Copied
Hey many thanks!!!
This solved my problem. I was searching that setting in general preferences...you saved me!!!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now