Closed celinede closed 5 years ago
Hello, try:
vips affine /in/file.tif /out/file.tif[pyramid,bigtiff] "scaling -rotation rotation scaling" --oarea "translation1 translation2 width height"
ie. swap compression=bigtiff
to just bigtiff
. BigTIFF isn't a compression type, it's a container format you enable when you open the file.
Thank you very much for your quick answer !
I have an additional question: My original file is a Bigtiff (compression jpeg 75%) of 1.7 Gb. After using 'vips affine ... [bigtiff] ... ' my output file is very big (32.6 Gb)... What kind of compression shall I apply to keep a file of a reasonable size ?
Glad it's working!
I would use jpeg
compression. It won't work for very large images unless you also use tiles, so I'd suggest:
vips affine /in/file.tif /out/file.tif[pyramid,bigtiff,tile,compression=jpeg] "1 0 0 1" --oarea "10 10 100 100"
Thanks, now I'm at 500 Mb !
And one more question: now, when I try to resize this file to 5%, it takes very long and doesn't seem to finish. Am I doing something wrong or is that normal ? My command is as follow: vips resize /in/file.tif /out/file.jpg 0.05
Pyramid tiffs come in a set of levels. You want to pick the level that's just larger than your target size as the source of your shrink.
For example:
john@katamata:~/pics$ vips copy nina.jpg x.tif[pyramid,tile,compression=jpeg]
john@katamata:~/pics$ vipsheader -a x.tif
x.tif: 6048x4032 uchar, 3 bands, srgb, tiffload
width: 6048
height: 4032
bands: 3
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 11.811
yres: 11.811
filename: x.tif
vips-loader: tiffload
n-pages: 7
resolution-unit: in
orientation: 1
It has 7 pages (each level is stored in a page). You can get a page like this:
john@katamata:~/pics$ vipsheader x.tif[page=2]
x.tif: 1512x1008 uchar, 3 bands, srgb, tiffload
So shrink like this:
john@katamata:~/pics$ vipsthumbnail x.tif[page=2] -s 1000 -o x.jpg
john@katamata:~/pics$ vipsheader x.jpg
x.jpg: 1000x667 uchar, 3 bands, srgb, jpegload
To make a jpg 1000 pixels across.
My file doesn't seem to have those 7 pages ... Although I had it formatted with [pyramid,bigtiff,tile,compression=jpeg]
vipsheader -a '/media/celine/Samsung_T1/Data_histo/RTP-3_derived/registered/05-10-2018_NothingRecognized-16647-registered.tif'
/media/celine/Samsung_T1/Data_histo/RTP-3_derived/registered/05-10-2018_NothingRecognized-16647-registered.tif: 114180x95200 uchar, 3 bands, srgb, tiffload
width: 114180
height: 95200
bands: 3
format: 0 - uchar
coding: 0 - none
interpretation: 22 - srgb
xoffset: 0
yoffset: 0
xres: 2267.586426
yres: 2267.586426
filename: "/media/celine/Samsung_T1/Data_histo/RTP-3_derived/registered/05-10-2018_NothingRecognized-16647-registered.tif"
vips-loader: tiffload
resolution-unit: cm
Looks like you're running an older libvips. page=
will still work, you just can't find out how many pages there are.
What is the scale difference between the different levels/pages ? Finally, is there a way to size the thumbnail using a proportions (like the 0.05 with resize) ?
The scale between levels is always exactly /2. You can just use resize if you prefer it.
Thank you very much for your help!
Hi, I'm facing some problems with the 'affine' function trying to register 2 images. I have computed my transformation matrix using my 2 images resized at 5% (could apply properly the transformation on the images at 5%) and would like now to apply the transformation to my original images. My original images are in BigTiff and from what I understand I would need my outputs saved as a BigTiff as well but don't know how to specify that?
My current command looks like: vips affine /in/file.tif /out/file.tif "scaling -rotation rotation scaling" --oarea "translation1 translation2 width height" And currently get the following error: TIFFAppendToStrip: Maximum TIFF file size exceeded
When I write the command as follow: vips affine /in/file.tif /out/file.tif[pyramid,compression=bigtiff] "scaling -rotation rotation scaling" --oarea "translation1 translation2 width height" I get the following error: tiffsave: enum 'VipsForeignTiffCompression' has no member 'bigtiff', should be one of: none, jpeg, deflate, packbits, ccittfax4, lzw
Am I miss a library or not asking for a bigtiff output properly ?
Thanks for your help, Céline