Photoshop and MATLAB

About Photoshop and MATLAB

MATLAB is a high-level technical computing language and interactive environment for algorithm development, data visualization, data analysis, and numeric computation. With Photoshop you can view MATLAB image-processing results in Photoshop, and combine MATLAB commands with Photoshop image-editing features.

Once you connect to Photoshop from MATLAB, typing commands into the MATLAB command prompt performs operations in Photoshop. You can run MATLAB algorithms and view the results in your image in Photoshop.


Communication between Photoshop and MATLAB uses the Photoshop JavaScript interface and the MATLAB library interface.

Set up MATLAB and Photoshop

Install Photoshop and MATLAB on your computer. Once you have installed Photoshop and MATLAB, you should verify the MATLAB integration.

Install the MATLAB Plug-in

Download and install the MATLAB plug-in package.


This package contains the MATLAB library and sample scripts for both English and Japanese.

For 64-bit systems, install the appropriate compiler

To use the Photoshop interface on a 64-bit system, a C compiler must be installed:

  • In Windows, install Microsoft Visual Studio.

  • In macOS, install XCode.

Verify MATLAB integration

  1. Start Photoshop and then MATLAB.

  2. From MATLAB, add the path Photoshop/MATLAB, including subfolders.
  3. At the MATLAB prompt, open the MATLAB folder, locate and open the Tests folder, and then type testall.
  4. Photoshop and MATLAB run a series of tests to ensure integration between the two programs and display a summary report.

(Optional) Set access to Photoshop from MATLAB

You can set up a path to Photoshop to allow direct access to Photoshop commands from MATLAB.

  1. From MATLAB, choose File > Set Path.
  2. Click Add Folder and select the MATLAB folder where Photoshop is installed.

  3. Click Save and then Close.
  4. From the MATLAB menu, choose File > Preferences.
  5. In the Preferences dialog box, click the General tree (upper-left).
  6. Click the Update Toolbox Path Cache button.
  7. Click Apply and then OK.

Connect/disconnect to Photoshop from MATLAB

  1. In MATLAB, do one of the following:
    • To launch or connect to Photoshop, type pslaunch, and then press Enter (Windows) or Return (macOS).

    • To disconnect from Photoshop and quit, type psquit and press Enter (Windows) or Return (macOS).

Using MATLAB Help

MATLAB’s Help system includes examples of a MATLAB/Photoshop workflow.

  1. Choose Help > Full Product Family Help.

    You see a Photoshop Toolbox with submenu items, including Examples for getting started. If you don’t see the Photoshop Toolbox, try the following steps.

  2. Click the Start Button.
  3. Choose Desktop Tools > View Source Files.
  4. Click the Refresh Start button, then Close, then retry the Help menu.

MATLAB commands

Typing commands in the MATLAB command line lets you connect and disconnect to Photoshop, and generate pixels viewable in a Photoshop document.

For a list of all MATLAB Photoshop commands, browse the file psfunctionscat.html, available in the MATLAB folder in the directory where you installed Photoshop. Enter help (command name) at the MATLAB command prompt for a fuller description of each command, including syntax, arguments, and examples.


All MATLAB commands are supported for Japanese characters. MATLAB for Windows supports a Japanese language user interface on Japanese language Windows systems. MATLAB for macOS supports US English only on Japanese language macOS systems. For more information, contact The MathWorks, Inc.

Create a document in MATLAB

  1. In MATLAB, enter psnewdoc.
  2. To specify the attributes of the new document, enter one of the following:
    • To create a document using the default values, enter psnewdoc(). For information on default values, see below.

    • To create a document with a specific width and height, enter psnewdoc(W,H). The W and H values use the current units set in the Units & Rulers option in the Photoshop Preferences dialog box. Other document attributes are set to their default values.


    Enter “undefined” as a string to skip input arguments. The default size for a new document is 504 x 360 pixels.  

    • To create a document and specify attributes, enter psnewdoc(W,H,R,N,M,F,A,B,P). For information on new document attributes, see below.

    Here is an example code for creating a document and specifying all the attributes in MATLAB:

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

New document attributes and defaults

Entering psnewdoc(W,H,R,N,M,F,A,B,P) creates a document with values for the following attributes:


Specifies the width of the document using the current units from the Units & Rulers option in the Photoshop Preferences dialog box. The default width is 504 pixels.


Specifies the height of the document using the current units in the Units & Rulers panel in the Photoshop Preference dialog box. The default height is 360.


Specifies the resolution. The default is 72 ppi.


Specifies the document name. The default is Untitled‑X, where X is the index for new documents.


Specifies the color mode: RGB, CMYK, Lab, Bitmap, or Grayscale. The default is RGB.


Specifies the background contents of the new document: White, Background Color, or Transparent. The default is White.


Specifies the pixel aspect ratio. The default is 1.0 (square).


Specifies the bit depth: 1, 8, 16, or 32. The default is 8.


Specifies the color profile. The default is the working color space for the specified color mode. The working spaces are specified in the Photoshop Color Settings dialog box.


Gaukite pagalbą greičiau ir lengviau

Naujas vartotojas?

Adobe MAX 2024

Adobe MAX
Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX

Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX 2024

Adobe MAX
Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX

Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu