-
-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VIPS commands #70
Comments
Hi, use affine with the standard 2D matrix for rotation:
At the command-line, that'd be:
In nip2, load the image, then click Image / Transform / Rotate / Free and drag the slider (or type a number). To change to 16 bit, use:
vips uses the C names for formats, so char and uchar are signed and unsigned 8 bit, short and ushort are signed and unsigned 16 bit, int and uint are signed and unsigned 32 bit, float and double are 32 and 64-bit floating point, and complex and dpcomplex are 64 and 128-bit complex. What do you mean by normalise? Can you give an example? |
Thanks for the response! I don't have the
Image normalization: |
Try im_affinei_all: $ vips im_affinei_all
usage: vips im_affinei_all in out interpolate a b c d dx dy
where:
in is of type "image"
out is of type "image"
interpolate is of type "interpolate"
a is of type "double"
b is of type "double"
c is of type "double"
d is of type "double"
dx is of type "double"
dy is of type "double"
affine transform of whole image, from package "resample"
flags: (PIO function) (coordinate transformer) (area operation) (result can be cached)``` Then something like:
dx/dy set a input-space translation, so zero is good for you. For normalisation, try scale:
|
Thanks John! Unfortunately, vips treats rotate_widget default x = class
_result {
_vislevel = 3;
angle = Option "Rotate by" [
"Don't rotate",
"90 degrees clockwise",
"180 degrees",
"90 degrees anticlockwise"
] default;
_result
= map_unary process x
{
process in = [
in,
rot90 in,
rot180 in,
rot270 in
] ? angle;
}
} |
You might need a more recent vips, I think this is somthing that's been improved. Try adding a space before the hyphen, eg.:
does that stop arg processing? In nip2 it'd be something like:
Then run with:
|
Yeah, I'm on a bit of an old release (7.28.5). The space fix worked, and I was able to successfully rotate the image -- thanks! The nip2 script also worked, although I ran into the same problem with negative numbers, and adding a space didn't fix things ( |
If I wanted to crop ( |
Sure:
You can put options to file input-output arguments in square brackets at the end of the filename, eg.:
|
Hey, I've been trying for some time (and have done a fair amount of Googling/reading) and haven't been able to to get nip2 to run the rotate script from the command line ( Neither work:
|
Try:
You need the brackets around Interpolate and Image_file. Yes, the --script argument is for writing batch files with nip2 as the interpreter. |
Excellent, that worked great! Thanks! |
I've added a simple thing to master to make this easier from the command-line: jcupitt@439522a You can now do things like:
It just calls vips_affine() for you, calculating the transform matrix from the scale and angle parameters. Other params are as vips_affine(). It'll be in the next stable version, due in a couple of weeks. |
I've read the docs on resample, but I can't figure out how to rotate an image
-0.20
degrees (i.e. 1/5th of a degree counter-clockwise).Also:
The text was updated successfully, but these errors were encountered: