question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dzsave of a large array of images

See original GitHub issue

I have a large array (maybe thousands) of images, that I’m joining first:

merged = pyvips.Image.arrayjoin(images, across=column_count)

and then trying to dzsave:

merged.dzsave(
    os.path.join(tmpdir, "deepzoom"),
    overlap=0,
    depth="onetile",
)

It seems, that dzsave requires all images to be simultaneously opened, because I’m getting

vips__file_open_read: unable to open file "/tmp/tmpn_kyd4w4/21/23.jpg" for reading
unix error: Too many open files

There is a 1024 opened files limit on my system which I don’t want to change.

The problem here is that even though any single tile does require only a small subset of opened files, libvips still opens all of them. It seems that this might be optimized.

Does it make sense? Is it hard to support this optimization?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jcupittcommented, Jun 10, 2020

Yes, you can use pyvips.Image.black(100, 100) to make a black image to add to your arrayjoin inputs. You can reuse the same image many times, eg.:

empty = pyvips.Image.black(100, 100)
mosaic = pyvips.Image.arrayjoin([t1, t2, empty, t3, t4, empty, empty, t5], across=2)
mosaic.dzsave(...)

It should be quick. The black images never really exist, they just supply pixels on demand as required by dzsave.

0reactions
al-muammarcommented, Jun 10, 2020

That’s great, thanks for suggestions! That should be definitely enough.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to save a very large numpy array as an image ...
This creates a blank TIFF file. Combining this with H5PY allowed me to save large images - or so I thought. The large...
Read more >
Image pyramids - libvips
It's fast and can generate pyramids for large images using only a small ... vips dzsave save image to deepzoom file usage: dzsave...
Read more >
Image — pyvips 2.2.1 documentation - GitHub Pages
Write the image to a large memory array. ... dzsave. Save image to deepzoom file. dzsave_buffer ... Embed an image in a larger...
Read more >
Making DeepZoom, Zoomify and Google Maps image ...
Here's the Zoomify viewer working on a large image. These things are very easy to make: you ... vips dzsave huge.tif myzoom --layout...
Read more >
Changelog for VIPS 7.40.11
... load and save vips mat format - rename image arrays as image matrices . ... larger max tile size for dzsave -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found