Hands-on tutorial

PhotoCraft layer mask tutorial: hide and restore part of a PSD

Make a reversible layer mask in PhotoCraft with real desktop screenshots or CLI commands. Save, reopen and disable the mask to recover the hidden pixels.

What you will make

Hide the outer part of a layer, save its mask, then switch the mask off to recover the original pixels.

Method
Desktop app · GUI
Version
PhotoCraft 0.18.0
Platform
Windows x64
Tested

This exercise uses the desktop interface. The original screenshots show Chinese interface labels. Results apply to the sample and version shown.

Need PhotoCraft? Choose an official download ↗
Small orange rectangle revealed by the saved layer mask
The mask reveals a 160 × 120 area inside the original 320 × 240 rectangle. View full size ↗

What this exercise does

A layer mask controls which parts of a layer are visible. We tested a simple rectangular mask in PhotoCraft 0.18.0 on Windows x64 using the included command-line tool. The starting document is a 640 × 480 PSD with an orange rectangle on a transparent canvas.

We selected a smaller rectangle inside the orange layer, created a mask from that selection, saved a new PSD and reopened it with PhotoCraft’s info command. The layer still had a mask. We then disabled the mask in another copy: the larger orange rectangle became visible again.

We repeated this CLI exercise on 4 November 2026 with the same 0.18.0 build. The files linked here are the outputs of that run. We also created and reopened a mask in the desktop app, as shown below.

Desktop 1. Make a small rectangular selection

Open transparent-source.psd and select Orange rectangle in Layers. Choose the Rectangular Marquee tool (M). In the top options bar, set Style to Fixed Size (样式 → 固定大小), Width to 160 px and Height to 120 px. Leave Feather at 0.

Click inside the orange rectangle to place the selection. Keep the whole selection within the coloured area. Its exact position can differ from ours; the fixed width and height give you the same-sized window.

PhotoCraft rectangular selection inside the orange layer, with fixed width 160 and height 120
The dotted outline is the area that the mask will reveal. The fixed-size fields are visible at the top. View full size ↗

Desktop 2. Add the mask, save and reopen

Click Add layer mask at the bottom of the Layers panel: the rectangle icon with a circle inside it. In this test, PhotoCraft used the selection for the mask and cleared the selection. Only the small orange area stayed visible.

Use File → Save As to save gui-masked.psd. Close it and reopen that saved file. You should still see the smaller rectangle and a mask thumbnail beside Orange rectangle. We performed this save-and-reopen check on 4 November 2026.

GUI-saved masked PSD reopened with the smaller orange rectangle and mask thumbnail
The saved file reopened with the mask still attached. The source pixels extend beyond the visible rectangle. View full size ↗

Desktop 3. Disable the mask to recover the image

Right-click the mask thumbnail beside Orange rectangle and choose Disable Layer Mask (禁用图层蒙版). The larger orange rectangle returns. A red cross appears over the disabled mask thumbnail.

Right-click it again and choose Enable Layer Mask (启用图层蒙版) to restore the smaller visible area. We re-enabled the mask before saving the downloadable example. Disabling the mask changes visibility without erasing the original pixels.

PhotoCraft showing the full orange rectangle after disabling the layer mask
The full rectangle returns when the mask is disabled. Its thumbnail has a red cross. View full size ↗

Before you begin

Keep an untouched copy of the starting PSD. Our file was created in PhotoCraft and contains two pixel layers. It is a controlled example, not a Photoshop-created project. We did not test text, smart objects, soft mask edges or transfer back to Photoshop.

The commands below were run in PowerShell 7.6.5 with the PhotoCraft 0.18.0 Windows x64 portable package. They use the executable photocraft-cli.exe. Put a copy of transparent-source.psd in the same folder as the executable and open PowerShell in that folder. Use new filenames for your outputs.

CLI 1. Select the area to reveal

Run the following command as one line. It opens the starting PSD, selects a 160 × 120 rectangle at x=240 and y=180, creates a layer mask from the selection, clears the selection and saves a new PSD.

powershell
.\photocraft-cli.exe run .\transparent-source.psd --cmd layer.select --params '{"name":"Orange rectangle"}' --cmd select.rect --params '{"x":240,"y":180,"width":160,"height":120}' --cmd layer.layerMask.revealSelection --cmd select.deselect --out .\masked.psd

CLI 2. Reopen the PSD and inspect the mask

Run this command to read the saved file:

  1. Find the layer named Orange rectangle in the output.
  2. Check that its kind is Pixel and hasMask is true.
  3. Check that the document is still 640 × 480.
powershell
.\photocraft-cli.exe info .\masked.psd

CLI 3. Export a preview

Run the following command, then open the PNG in a viewer that can show transparency.

Small orange rectangle on a transparent 640 by 480 canvas
Our PNG after applying the mask. The empty area is transparent; the page background shows through it. View full size ↗
powershell
.\photocraft-cli.exe convert .\masked.psd .\masked.png

CLI 4. Compare with the mask disabled

To check that the mask is hiding pixels in this example, make a separate PSD with the mask disabled, then export it. The first command leaves masked.psd intact.

Larger orange rectangle visible after the layer mask was disabled
With the mask disabled in our copy, the larger rectangle appears again. View full size ↗
powershell
.\photocraft-cli.exe run .\masked.psd --cmd layer.layerMask.enabled --params '{"enabled":false}' --out .\mask-disabled.psd
.\photocraft-cli.exe convert .\mask-disabled.psd .\mask-disabled.png

Check the result and its limits

The masked PNG had an opaque centre pixel at x=320, y=240. At x=200, y=150, inside the original orange rectangle but outside the revealed area, its alpha was zero. With the mask disabled, that same pixel was orange and opaque. Both PNG conversions warned that the two layers were flattened.

These checks show what happened with this one file and build. They do not prove a different PSD, a soft-edged mask or a Photoshop round trip will behave the same way. Keep the layered source and test the exact handoff your recipient needs.