Replies: 6 comments 2 replies
-
Hi again, thanks for the report! It's great to have these extreme cases tested. Cropping a tiff can take a lot of memory, depending on the exact tiff layout. Could you run
|
Beta Was this translation helpful? Give feedback.
-
tiffinfo scroll1_8.tif
TIFF Directory at offset 0x1860138720016 (1b118e85b10)
Image Width: 1409196 Image Length: 440000
Resolution: 300, 300 pixels/inch
Bits/Sample: 8
Sample Format: unsigned integer
Compression Scheme: None
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Rows/Strip: 128
Planar Configuration: single image plane
I assume you don't want the XML stuff.
…On Wed, 17 Apr 2024 at 20:08, John Cupitt ***@***.***> wrote:
Hi again, thanks for the report! It's great to have these extreme cases
tested.
Cropping a tiff can take a lot of memory, depending on the exact tiff
layout. Could you run tiffinfo on your test image and copy-paste the
output? eg. I see:
$ tiffinfo k2.tif
=== TIFF directory 0 ===
TIFF Directory at offset 0x10fe008 (17817608)
Image Width: 1450 Image Length: 2048
Resolution: 72.009, 72.009 pixels/inch
Bits/Sample: 16
Sample Format: unsigned integer
Compression Scheme: None
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Rows/Strip: 128
Planar Configuration: single image plane
—
Reply to this email directly, view it on GitHub
<#3936 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLREF2DAGFSR2ODILTFARTY5ZC2HAVCNFSM6AAAAABGKHVGDWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TCNBQGU4TM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Paul Bourke
paulbourke.net
***@***.***
+61 433338325
|
Beta Was this translation helpful? Give feedback.
-
I managed to reproduce this with a 4tb external hdd:
(almost 7h!) Then:
So it's killed after 5s with 124gb of ram used. It shouldn't need so much, I'll investigate. |
Beta Was this translation helpful? Give feedback.
-
Pretty much exactly what I was seeing.
I've written my own crop, just processes a row at a time of a .v file and
on a SSD it motors through quite well.
…On Thu, 18 Apr 2024 at 19:24, John Cupitt ***@***.***> wrote:
I managed to reproduce this with a 4tb external hdd:
$ time vips black huge.tif 1409196 440000 --bands 3 --vips-progress
vips temp-1: 1409196 x 440000 pixels, 32 threads, 1409196 x 1 tiles, 640 lines in buffer
vips temp-1: done in 2.3e+04s
real 387m33.367s
user 116m1.998s
sys 9m2.398s
(almost 7h!)
Then:
$ /usr/bin/time -f %M:%e time vips crop huge.tif x.tif 1000000 380000 20000 20000
Command terminated by signal 9
4.88user 58.85system 1:03.96elapsed 99%CPU (0avgtext+0avgdata 124079616maxresident)k
4128inputs+0outputs (21major+31353035minor)pagefaults 0swaps
Command exited with non-zero status 137
124079616:63.97
So it's killed after 5s with 124gb of ram used. It shouldn't need so much,
I'll investigate.
—
Reply to this email directly, view it on GitHub
<#3936 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLREF36PFMGOCGLHUBN3UTY56GOHAVCNFSM6AAAAABGKHVGDWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TCNJSG4ZTQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Paul Bourke
paulbourke.net
***@***.***
+61 433338325
|
Beta Was this translation helpful? Give feedback.
-
... it's a small thing, I didn't bother with a PR 12c0e62 I now see sane cropping behaviour with huge TIFF images. |
Beta Was this translation helpful? Give feedback.
-
Slight tangent: Cropping strip TIFFs (the default TIFF layout) will always be slow (libvips has to read every byte up to the crop point to find out where to start), but tiled TIFFs will crop quickly (TIFF stores an index of tile positions in the file and can seek directly to the position of a pixel). Anyone working with huge TIFFs should probably save as a tiled tiff, eg.
File size is the same. It works well with compression too:
Since each tile is compressed and indexed separately. |
Beta Was this translation helpful? Give feedback.
-
Here's some other "interesting" cases/fails.
Using the same input image in tif and vips format.
Windows
Ubuntu
Beta Was this translation helpful? Give feedback.
All reactions