public static function run($dataDir = null)
 {
     # Create an instance of PsdOptions and set it's properties
     $create_options = new PsdOptions();
     # Set source
     $create_options->setSource(new FileCreateSource($dataDir . "CreatePSD.psd", false));
     # Set ColorMode to Indexed
     $colorModes = new ColorModes();
     $create_options->setColorMode($colorModes->Indexed);
     # Set PSD file version
     $create_options->setVersion(5);
     $color = new Color();
     # Create a new color patelle having RGB colors
     $palette = [$color->getRed(), $color->getGreen(), $color->getBlue()];
     # Set Palette property to newly created palette
     $create_options->setPalette(new PsdColorPalette($palette));
     # Set compression method
     $compressionMethod = new CompressionMethod();
     $create_options->setCompressionMethod($compressionMethod->RLE);
     # Create a new PSD with PsdOptions created previously
     $psdImage = new PsdImage();
     $psd = $psdImage->create($create_options, 500, 500);
     # Draw some graphics over the newly created PSD
     $graphics = new Graphics($psd);
     $graphics->clear($color->getWhite());
     $graphics->drawEllipse(new Pen($color->getRed(), 6), new Rectangle(0, 0, 400, 400));
     $psd->save();
     # Display Status.
     print "Created PSD successfully!" . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Load an existing image (of type bmp) in an instance of Image class
     $image = new Image();
     $image = $image->load($dataDir . "aspose.bmp");
     # Create an instance of PsdSaveOptions class
     $save_options = new PsdOptions();
     # Set the CompressionMethod as Raw
     # Note: Other supported CompressionMethod is CompressionMethod.Rle [No Compression]
     $compressionMethod = new CompressionMethod();
     $save_options->setCompressionMethod($compressionMethod->Raw);
     # Set the ColorMode to GrayScale//Note: Other supported ColorModes are ColorModes.Bitmap and ColorModes.RGB
     $colorModes = new ColorModes();
     $save_options->setColorMode($colorModes->RGB);
     # Save the image to disk location with supplied PsdOptions settings
     $image->save($dataDir . "output.psd", $save_options);
     # Display Status.
     print "Image exported to PSD successfully!" . PHP_EOL;
 }