I have a largish PSD file with a couple of hundred layers, that I would like to extract selected areas from into PNG files.
Areas can consist of a couple of layers.
Being new to Photoshop, I have been using the following workaround. Duplicate needed layers into a new scratch PSD file of same size, TRIM to transparency, Save As PNG, undo TRIM, hide layers, rinse and repeat...
I suppose I could do it without the scratch file and just crop selection, Save As PNG and undo, but there must be a nicer method.
What other ways are there to accomplish this export of a selected area to PNG?
EDIT: This is on Windows Xp running Photoshop CS3 Extended
4 Answers
- Make your selection
- Edit -> Copy Merged
- File -> New (Photoshop should automatically suggest a new canvas size to match the selection size)
- Edit -> Paste
- File -> Save As (PNG)
- Rinse and repeat... (keyboard shortcuts are handy here)
(Tested on Photoshop CS4)
3Try selecting the areas with the Slice tool and then File > Export for web & devices.
5I tackled this by creating a script that I put in Presets\Scripts\Export Selection to PNG.jsx
The code as follows:
app.displayDialogs = DialogModes.NO;
var pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.compression = 9;
var hasSelection;
var docRef;
try { hasSelection = !!app.activeDocument.selection.bounds;
} catch (err) { hasSelection = false;
}
if (hasSelection) { app.activeDocument.selection.copy(true); var w = app.activeDocument.selection.bounds[2]; var h = app.activeDocument.selection.bounds[3]; docRef = app.documents.add(w, h); docRef.paste();
} else { docRef = app.activeDocument;
}
var file = File.saveDialog("Export as PNG to...");
if (file && ((file.exists && confirm("Overwrite " + file +"?")) || !file.exists)) { docRef.saveAs(file, pngSaveOptions, !hasSelection, Extension.LOWERCASE); if (hasSelection) { docRef.close(SaveOptions.DONOTSAVECHANGES); }
}The script above will handle no-selection as a "select all" and checks if the target file exists confirming an overwrite.
This script is triggered from the File->Scripts->Export Selection to PNG
Make a selection. Then hit Ctr or CMD + J to copy that selection into a new layer. then:
File -> Scripts -> Export Layer to Files...If your layer is smaller than the full width/height of the canvas don't forget to check Trim Layers.