Example: creating thumbnails in Adobe Photoshop
foreach my $image_file(@files) {
my $desc = $ps->MakeDescriptor();
my $control = $ps->MakeControlObject();
$desc->PutPath(phKeyNull,$image_file);
$control->Play(phEventOpen,$desc,phDialogSilent);
$desc = $ps->MakeDescriptor();
$control = $ps->MakeControlObject();
$desc->PutBoolean(phKeyAuto, 1);
$control->Play(phEventLevels,$desc,phDialogSilent);
$desc = $ps->MakeDescriptor();
$control = $ps->MakeControlObject();
$desc->PutUnitDouble(phKeyWidth, phUnitPixels, $size);
$desc->PutBoolean(phKeyConstrainProportions, 1);
$desc->PutEnumerated(phKeyInterfaceIconFrameDimmed,
phTypeInterpolation,phEnumBicubic);
$control->Play(phEventImageSize,$desc,phDialogSilent);
$control = $ps->MakeControlObject();
my $d1 = $ps->MakeDescriptor();
my $d2 = $ps->MakeDescriptor();
$d2->PutEnumerated(phKeyPNGInterlaceType,phTypePNGInterlaceType,
phEnumPNGInterlaceNone);
$d2->PutEnumerated(phKeyPNGFilter,phTypePNGFilter,
phEnumPNGFilterAdaptive);
$d1->PutObject(phKeyAs,phClassPNGFormat,$d2);
(my $outfile = File::Spec->rel2abs($image_file)) =~
s/\.+[^\.]+$/_thumb${size}.png/;
$outfile =~ s/\s//g;
$d1->PutPath(phKeyIn,$outfile);
$d1->PutBoolean(phKeyLowerCase, 1);
$control->Play(phEventSave,$d1,phDialogSilent);
$desc = $ps->MakeDescriptor();
$control = $ps->MakeControlObject();
$control->Play(phEventClose,$desc,phDialogSilent);
}
$ps->Quit();