Class BackgroundColorResource

  • public final class BackgroundColorResource
    extends ResourceBlock

    The resource with border information of image print settings.

    Code example:

    An example of reading and modifying a background color resource.

    String inPsdFilePath = "input.psd";
    String outPsdFilePath = "output.psd";
    // Load a PSD file containing a predefined background color resource
    PsdImage psdImage = (PsdImage)Image.load(inPsdFilePath);
        BackgroundColorResource backgroundColorResource = null;
        for (ResourceBlock imageResource : psdImage.getImageResources())
            if (imageResource instanceof BackgroundColorResource)
                backgroundColorResource = (BackgroundColorResource)imageResource;
        if (backgroundColorResource == null)
            throw new Exception("BackgroundColorResource not found");
        // Update color of the background color resource
        // Save a modified copy of loaded PSD file on the path;

    • Constructor Detail

      • BackgroundColorResource

        public BackgroundColorResource()

        Initializes a new instance of the BackgroundColorResource class.

    • Method Detail

      • getDataSize

        public int getDataSize()

        Gets the resource data size in bytes.

        Value: The resource data size.
        Specified by:
        getDataSize in class ResourceBlock
      • getColor

        public final Color getColor()

        Gets or sets the background color.

      • setColor

        public final void setColor(Color value)

        Gets or sets the background color.

      • getMinimalVersion

        public int getMinimalVersion()

        Gets the minimal required PSD version.

        Value: The minimal PSD version.
        Specified by:
        getMinimalVersion in class ResourceBlock
      • setColorSpace

        public final void setColorSpace(int value)

        Gets or sets a color space.

        Value: The background color space.