blob: 51ead9b55b11f93078b4957f2a4d0f4f4b570927 (
plain)
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
|
#!/opt/kde3/bin/kjscmd
//
// Load an image, scale it, and save it in the specified format.
//
if ( application.args.length >= 3 ) {
var infile = application.args[0];
var outfile = application.args[1];
var scale = application.args[2];
var img = new Image();
img.load( infile );
if ( img.isOk() ) {
if ( application.args.length > 3 ) {
img.format = application.args[3];
}
img.smoothScale( img.width*(scale/100.0), img.height*(scale/100.0) );
img.save( outfile );
}
}
else {
System.out.println( 'Usage:' );
System.err.println( '\timagescale imgfile outfile percent [format]' );
}
|