I’m a huge fan of Cut&Slice Me and I’ve been using it a lot. The plugin is very simple and it produces great quality results. However, it’s missing one important thing. C&SM assumes you’re working off of an XHDPI (@x2) document where most of our projects are XXHDPI (@3x). For some time our workaround was to first export everything from the @3x PSD, rename the generated XHDPI folder to XXHDPI, then resize the PSD by 66.66% and export again. Older versions of C&SM assumed you were working off of an XHDPI (@x2) document where most of our projects are XXHDPI (@3x). Luckily, C&SM now supports XXHDPI as of version 1.1.3. Before that, however, our workaround was to first export everything from the @3x PSD, rename the generated XHDPI folder to XXHDPI, then resize the PSD by 66.66% and export again.

After using this workflow for a few weeks, it became apparent that the constant resizing was an inefficient use of time and also left room for errors. I would accidentally save the scaled down document or, worse, send the wrong assets to the developer because I exported everything from the wrong size.

To save us some time and double work, I created a quick script that produces similar results to C&SM but without having to manually scale down your document.

The script works by duplicating the selected layer (or layergroup) to a new document, then scaling it to each of the 5 common Android sizes (XXHDPI, XHDPI, HDPI, MDPI, and LDPI) and then putting the files inside a folder next to the PSD.

Installation

  1. Download the script here
  2. Move the .jsx file to your Photoshop scripts folder:

Mac: /Applications/Adobe Photoshop…/Presets/Scripts/

PC 64bit: *C:\Program Files\Adobe\Adobe Photoshop… (64 Bit)\Presets\Scripts*

PC 32bit: *C:\Program Files\Adobe\Adobe Photoshop…\Presets\Scripts*

Running the script

With the layer (or layergroup) that you’d like to export selected, go to File>Scripts>Browse and open the script. The script will do its magic and a new “assets” folder with the assets will be created.

## Why not a plugin?

As I mentioned above, we are huge C&SM fans. The author has mentioned before that he’s working on an update so this script is just to help us until the new version arrives.

Help us make it better

If you know your way around JavaScript —or are adventurous enough to play with it— fork the script on GitHub.

Share Via

View Comments