Skip to content
Snippets Groups Projects
Commit 12bb1db5 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

Photoshop jpg compression script and updated README

parent fcdad114
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,11 @@ Editing JPGs ...@@ -34,7 +34,11 @@ Editing JPGs
cd /path/to/workspace/unl_tourmap/www/images/tilesets/unl cd /path/to/workspace/unl_tourmap/www/images/tilesets/unl
2. Run: 2. Run:
find . -name *.jpg -type f -exec php ../../../../map_source/process_jpgs.php {} \; find . -name *.jpg -type f -exec php ../../../../map_source/process_jpgs.php {} \;
Compressing JPGs
(Quality can be adjusted by opening the script file specified below and changing the number by the comment "set quality to suit")
1. In Photoshop CS5: File->Scripts->Browse...
2. Select /path/to/workspace/unl_tourmap/map_source/photoshop_jpg_compress_script.jsx
3. Select /path/to/workspace/unl_tourmap/www/images/tilesets/unl
** Updating Map Features: ** Updating Map Features:
......
var imageFolder = Folder.selectDialog("Select the folder with JPGs to process");
if (imageFolder != null) processFolder(imageFolder);
function processFolder(folder) {
var fileList = folder.getFiles()
for (var i = 0; i < fileList.length; i++) {
var file = fileList[i];
if (file instanceof File && file.name.match(/\.jpg$/i)) {
open(file);
var doc = app.activeDocument;
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
var saveFile = new File(decodeURI(activeDocument.fullName.fsName));
saveFile.remove();
SaveForWeb(saveFile,25); // set quality to suit
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
} else
if (file instanceof Folder) {
processFolder(file);
}
}
}
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality;
app.activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment