Sub topic 11
Export 1x, 2x, and 3x Versions for High-Density Screens
Understand pixel density
This chapter assumes you can navigate Photoshop, work with layers, and use the Export As dialog.
A CSS pixel is a layout unit used by a website. A device pixel is a physical pixel on a screen. High-density screens use several device pixels to display one CSS pixel. A 2x screen needs twice as many image pixels in each direction. A 3x screen needs three times as many.
If an image appears at 400 × 300 CSS pixels, prepare these versions:
| Scale | Export dimensions | Typical use |
|---|---|---|
| 1x | 400 × 300 px | Standard-density screen |
| 2x | 800 × 600 px | Retina or high-density screen |
| 3x | 1200 × 900 px | Very high-density screen |
The 2x and 3x files contain more detail when the browser displays them at the same CSS size. Their pixel area also grows quickly. A 2x image has four times the pixels of a 1x image. A 3x image has nine times the pixels, so check file size carefully.
Export several scales from Export As
- Open the finished Photoshop document and confirm that the source contains enough detail for the largest scale.
- Choose File > Export > Export As.
- Select an image format. Use PNG for transparency or sharp interface graphics. Use JPEG or WebP for photographs.
- In the Export As dialog, add scale entries for 1x, 2x, and 3x. Set the scale values to 100%, 200%, and 300%.
- Add a suffix or naming pattern that distinguishes each output, such as
@1x,@2x, and@3x. - Check the preview for each scale. Confirm that the dimensions and format are correct.
- Click Export and choose an output folder.
Photoshop resamples the document for each scale. Resampling means calculating new pixels when an image changes size. Exporting a smaller version usually removes detail. Exporting a larger version cannot restore detail that was never present, so begin with a source large enough for 3x.
Use generated assets for repeated exports
For separate layers or groups, Photoshop can generate image assets from layer names. Choose File > Generate > Image Assets, then name layers with the desired format and scale.
hero.jpg90%
icon-search.png
icon-search-2x.png
200% badge.png
300x300 avatar.jpgA percentage prefix requests a scale. A dimension prefix requests a fixed output size. Keep names descriptive and avoid spaces when your website build system handles filenames poorly.
Connect files to a browser
The website should display every version at the same logical size. Its image-selection method can choose a larger file for a denser screen.
Exercise
Exercise
An icon displays at 96 × 96 CSS pixels. What pixel dimensions should its 1x, 2x, and 3x exports use?
Show answer
The 1x export should be 96 × 96 px, the 2x export should be 192 × 192 px, and the 3x export should be 288 × 288 px.