Leser: 2
|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
#! /usr/bin/perl
use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const 'Photoshop';
QuoteNo type library matching "Photoshop" found at ps_skript.pl line 6
Win32::OLE(0.1502): GetOleTypeLibObject() Not a Win32::OLE::TypeLib object at c:/wampp1/perl/site/lib/Win32/OLE/Const.pm line 45.
QuoteThis is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /usr/bin/perl
use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const 'Adobe Photoshop';
my $ps = Win32::OLE->new('Photoshop.Application') or die $!;
[...]
$d1->PutBoolean(phKeyLowercase, 1);
[...]
QuoteBareword "phKeyLowercase" not allowed while "strict subs" in use at ps_skript.pl line 46.
Execution of ps_skript.pl aborted due to compilation errors.
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/perl -wl
package ap;
use Win32::OLE::Const "Adobe Photoshop";
package main;
$, = $/;
print sort grep defined *{"ap::$_"}{"CODE"}, keys %ap::;
$d1->PutBoolean(phKeyLowercase, 1);
QuoteBareword "phKeyLowercase" not allowed while "strict subs" in use at ps_skript.pl line 46.
Execution of ps_skript.pl aborted due to compilation errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /usr/bin/perl
use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const 'Adobe Photoshop';
use File::Spec;
use Getopt::Long;
my ($dir,$size) = ('./',350);
GetOptions('-d=s' => \$dir,
'-s=n' => \$size,);
opendir(DIR,$dir) or die $!;
my @files = grep{$_ !~ /^\.\.?$/}readdir(DIR);
closedir DIR;
foreach my $image_file(@files){
$image_file = $dir.'/'.$image_file;
# start photoshop
my $ps = Win32::OLE->new('Photoshop.Application') or die $!;
$ps->{Visible} = 0;
# open image
my $desc = $ps->MakeDescriptor();
my $control = $ps->MakeControlObject();
$desc->PutPath(phKeyNull,$image_file);
$control->Play(phEventOpen,$desc,phDialogSilent);
# autolevels
$desc = $ps->MakeDescriptor();
$control = $ps->MakeControlObject();
$desc->PutBoolean(phKeyAuto, 1);
$control->Play(phEventLevels,$desc,phDialogSilent);
# resize image
$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/;
print $outfile,"\n";
$d1->PutPath(phKeyIn,$outfile);
$d1->PutBoolean(phKeyLowerCase, 1);
$control->Play(phEventSave,$d1,phDialogSilent);
$desc = $ps->MakeDescriptor();
$control = $ps->MakeControlObject();
$control->Play(phEventClose,$desc,phDialogSilent);
}
|< 1 2 >| | 18 Einträge, 2 Seiten |