diff --git a/README b/README index e97fdecfee3cc87654ace74b28fc7a8b502e3347..7e9f82dfe0b2c229f4ae6081ae7965fb336e8064 100644 --- a/README +++ b/README @@ -34,7 +34,11 @@ Editing JPGs cd /path/to/workspace/unl_tourmap/www/images/tilesets/unl 2. Run: 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: diff --git a/map_source/photoshop_jpg_compress_script.jsx b/map_source/photoshop_jpg_compress_script.jsx new file mode 100644 index 0000000000000000000000000000000000000000..f591167b6d8c139095f5ce41986e49bd6f8f00b0 --- /dev/null +++ b/map_source/photoshop_jpg_compress_script.jsx @@ -0,0 +1,36 @@ +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