manpages for resize and rotate
This commit is contained in:
parent
d58a409a12
commit
65e50862cf
3 changed files with 84 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
.TH RESAMPLE 1
|
.TH RESAMPLE 1
|
||||||
.SH NAME
|
.SH NAME
|
||||||
resample \- resample a picture
|
resample, resize - resample a picture
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B resample
|
.B resample
|
||||||
[
|
[
|
||||||
|
@ -12,11 +12,27 @@ resample \- resample a picture
|
||||||
] [
|
] [
|
||||||
.I file
|
.I file
|
||||||
]
|
]
|
||||||
|
.br
|
||||||
|
.B resize
|
||||||
|
[
|
||||||
|
.B -x
|
||||||
|
.I size
|
||||||
|
] [
|
||||||
|
.B -y
|
||||||
|
.I size
|
||||||
|
] [
|
||||||
|
.I file
|
||||||
|
]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I Resample
|
.I Resample
|
||||||
|
and
|
||||||
|
.I Resize
|
||||||
resamples its input image (default standard input) to a new size.
|
resamples its input image (default standard input) to a new size.
|
||||||
The image is decimated or interpolated using
|
.I Resample
|
||||||
a Kaiser window.
|
uses a Kaiser window which produces high quality results and
|
||||||
|
.I resize
|
||||||
|
uses bilinear interpolation which is faster but produces more
|
||||||
|
fuzzy images.
|
||||||
.PP
|
.PP
|
||||||
The size of the resampled image can be specified
|
The size of the resampled image can be specified
|
||||||
with the
|
with the
|
||||||
|
@ -24,7 +40,8 @@ with the
|
||||||
and
|
and
|
||||||
.B -y
|
.B -y
|
||||||
options.
|
options.
|
||||||
An unadorned value sets the number of pixels of that dimension; a suffixed percent sign specifies a percentage.
|
An unadorned value sets the number of pixels of that dimension; a
|
||||||
|
suffixed percent sign specifies a percentage.
|
||||||
If only one of
|
If only one of
|
||||||
.B -x
|
.B -x
|
||||||
or
|
or
|
||||||
|
@ -51,8 +68,8 @@ To uncompress the image or change the pixel format, use
|
||||||
.PP
|
.PP
|
||||||
.SH SOURCE
|
.SH SOURCE
|
||||||
.B /sys/src/cmd/resample.c
|
.B /sys/src/cmd/resample.c
|
||||||
|
.br
|
||||||
|
.B /sys/src/cmd/resize.c
|
||||||
.SH "SEE ALSO
|
.SH "SEE ALSO
|
||||||
.IR crop (1),
|
.IR crop (1),
|
||||||
.IR image (6)
|
.IR image (6)
|
||||||
.SH BUGS
|
|
||||||
Faster algorithms exist, but this implementation produces correct pictures.
|
|
||||||
|
|
36
sys/man/1/rotate
Normal file
36
sys/man/1/rotate
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
.TH ROTATE 1
|
||||||
|
.SH NAME
|
||||||
|
rotate - rotate or mirror a picture
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B rotate
|
||||||
|
[
|
||||||
|
.B -r
|
||||||
|
.I degree
|
||||||
|
] [
|
||||||
|
.B -u |
|
||||||
|
.B -l
|
||||||
|
] [
|
||||||
|
.I file
|
||||||
|
]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.I Rotate
|
||||||
|
reads its input image (default from standard input), applies the rotation
|
||||||
|
or mirroring and outputs the transformed image in compressed
|
||||||
|
plan9 bitmap format.
|
||||||
|
.PP
|
||||||
|
The option
|
||||||
|
.B -r
|
||||||
|
rotates the image clockwise in 90 degree steps by the
|
||||||
|
.I degree
|
||||||
|
argument.
|
||||||
|
The options
|
||||||
|
.B -u
|
||||||
|
and
|
||||||
|
.B -l
|
||||||
|
mirror the image upside/down or left/right.
|
||||||
|
.SH SOURCE
|
||||||
|
.B /sys/src/cmd/rotate.c
|
||||||
|
.SH "SEE ALSO
|
||||||
|
.IR crop (1),
|
||||||
|
.IR resample (1),
|
||||||
|
.IR image (6)
|
|
@ -70,10 +70,25 @@ resample(Memimage *dst, Rectangle r, Memimage *src, Rectangle sr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PERCENT = 0x80000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
getsize(char *s)
|
||||||
|
{
|
||||||
|
int v;
|
||||||
|
|
||||||
|
v = strtol(s, &s, 10) & ~PERCENT;
|
||||||
|
if(*s == '%')
|
||||||
|
v |= PERCENT;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
sysfatal("Usage: %s [ -x width ] [ -y height ] [image]\n", argv0);
|
sysfatal("Usage: %s [ -x width ] [ -y height ] [ file ]\n", argv0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -86,11 +101,14 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
xsize = ysize = 0;
|
xsize = ysize = 0;
|
||||||
ARGBEGIN{
|
ARGBEGIN{
|
||||||
|
case 'a':
|
||||||
|
xsize = ysize = getsize(EARGF(usage()));
|
||||||
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
xsize = atoi(EARGF(usage()));
|
xsize = getsize(EARGF(usage()));
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
ysize = atoi(EARGF(usage()));
|
ysize = getsize(EARGF(usage()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
@ -104,6 +122,10 @@ main(int argc, char **argv)
|
||||||
memimageinit();
|
memimageinit();
|
||||||
if((im = readmemimage(fd)) == nil)
|
if((im = readmemimage(fd)) == nil)
|
||||||
sysfatal("readmemimage: %r");
|
sysfatal("readmemimage: %r");
|
||||||
|
if(xsize & PERCENT)
|
||||||
|
xsize = ((xsize & ~PERCENT) * Dx(im->r)) / 100;
|
||||||
|
if(ysize & PERCENT)
|
||||||
|
ysize = ((ysize & ~PERCENT) * Dy(im->r)) / 100;
|
||||||
if(xsize || ysize){
|
if(xsize || ysize){
|
||||||
if(ysize == 0)
|
if(ysize == 0)
|
||||||
ysize = (xsize * Dy(im->r)) / Dx(im->r);
|
ysize = (xsize * Dy(im->r)) / Dx(im->r);
|
||||||
|
|
Loading…
Reference in a new issue