UXP Toolkit
    Preparing search index...

    Image data is represented by a PhotoshopImageData instance.

    objects/returnobjects

    interface PhotoshopImageData {
        chunky: boolean;
        colorProfile: string;
        colorSpace: ColorSpace;
        components: number;
        componentSize: 8 | 16 | 32;
        dispose: () => Promise<void>;
        getData: (
            options: GetDataOptions,
        ) => Promise<
            | Uint8Array<ArrayBufferLike>
            | Uint16Array<ArrayBufferLike>
            | Float32Array<ArrayBufferLike>,
        >;
        hasAlpha: boolean;
        height: number;
        pixelFormat: PixelFormat;
        type: "image/uncompressed";
        width: number;
    }
    Index

    Properties

    chunky: boolean

    True if the image data internally is using the chunky format.

    colorProfile: string

    The color profile for the image data. For example, "sRGB IEC61966-2.1". If the color profile is empty, then the profile of a target document will be used.

    colorSpace: ColorSpace

    The color space (or mode) for the image data.

    components: number

    Number of components per pixel. This is 3 for RGB, 4 for RGBA and so forth.

    componentSize: 8 | 16 | 32

    Number of bits per component. This can be 8, 16, or 32.

    dispose: () => Promise<void>

    Calling this synchronous method will release the contained image data. Doing so will reduce memory usage faster then waiting for the JavaScript garbage collector to run.

    pixelData.dispose();
    
    getData: (
        options: GetDataOptions,
    ) => Promise<
        | Uint8Array<ArrayBufferLike>
        | Uint16Array<ArrayBufferLike>
        | Float32Array<ArrayBufferLike>,
    >

    Return pixel information from an PhotoshopImageData instance as a typed array. The return type depends on the componentSize of the image.

    Component Size Return type
    8 Uint8Array
    16 Uint16Array
    32 Float32Array

    Example:

    const pixelData = await imageObj.imageData.getData()
    
    hasAlpha: boolean

    True if the image data includes an alpha channel.

    height: number

    The height of the image data in pixels.

    pixelFormat: PixelFormat

    Memory layout (order) of components in a pixel.

    type: "image/uncompressed"

    Type of contained data. At the moment only "image/uncompressed" is supported.

    width: number

    The width of the image data in pixels.