MATLAB document attributes for Photoshop

Last updated on Oct 6, 2026

Learn about the document attributes, parameter values, and default settings for creating Photoshop documents by using MATLAB commands.

Creating Photoshop documents programmatically requires valid document attributes and parameter values. Use this reference to understand the supported parameters, their accepted values, default settings, and dependencies when using the psnewdoc MATLAB function to create new Photoshop documents.

psnewdoc function syntax

Use the following syntax to create Photoshop documents from MATLAB:

Syntax

Description

psnewdoc()

Creates a document by using default values for all attributes.

psnewdoc(W, H)

Creates a document with the specified width and height. All other attributes use default values.

psnewdoc(W, H, R, N, M, F, A, B, P)

Creates a document by specifying all supported document attributes.

Note

If you want to specify a later parameter without assigning an earlier one, use the string "undefined" for the skipped parameter.

Example

psnewdoc(10, 10, 72, 'hi', 'cmyk', 'transparent', 2.5, 16, 'U.S. Web Coated (SWOP) v2')

This command creates a 10 × 10 document named “hi” with the following settings:

  • Resolution: 72 ppi
  • Color mode: CMYK
  • Background: Transparent
  • Pixel aspect ratio: 2.5
  • Bit depth: 16 bits per channel
  • Color profile: U.S. Web Coated (SWOP) v2

Document attributes

Parameter

Attribute

Data type

Description

W

Width

Numeric

Specifies the document width by using the current Photoshop ruler units.

H

Height

Numeric

Specifies the document height by using the current Photoshop ruler units.

R

Resolution

Numeric

Specifies the document resolution in pixels per inch (ppi).

N

Name

String

Specifies the document name displayed in Photoshop.

M

Mode

String

Specifies the color mode. Supported values are RGB, CMYK, Lab, Bitmap, and Grayscale.

F

Fill

String

Specifies the background contents. Supported values are White, BackgroundColor, and Transparent.

A

Aspect Ratio

Numeric

Specifies the pixel aspect ratio. A value of 1.0 represents square pixels.

B

Bit Depth

Numeric

Specifies the bits per channel. Supported values are 1, 8, 16, and 32.

P

Profile

String

Specifies the Photoshop color profile name. The value must match a profile listed in Color Settings.

Default values

When you omit parameters or call psnewdoc() without arguments, Photoshop uses the following defaults:

Attribute

Default value

Width

504 pixels

Height

360 pixels

Resolution

72 ppi

Name

Untitled-X (where X is the sequential document number)

Mode

RGB

Fill

White

Aspect Ratio

1.0 (square pixels)

Bit Depth

8 bits per channel

Profile

Working color space for the selected color mode from Photoshop Color Settings

Units and dependencies

Keep the following dependencies in mind when creating Photoshop documents from MATLAB:

Dependency

Details

Width and height

Photoshop interprets width and height according to the current Units & Rulers preference. Change the ruler units before running psnewdoc if you want to use units other than pixels.

Color profile

The profile name must exactly match a profile listed in Edit > Color Settings. If the specified profile name is invalid, Photoshop uses the working color space for the selected color mode instead.