Comments (6)
dzsave writes all the tiles and all the layers in parallel as it scans the image, so it wouldn't actually be much faster to only write a single layer.
For example, to build an entire pyramid:
$ time vips dzsave 044TracheaEsophCat.svs x
real 7m54.842s
user 18m18.328s
sys 3m10.148s
Or to just scan the image and calculate some statistics:
$ time vips stats 044TracheaEsophCat.svs x.v
real 6m38.004s
user 15m6.848s
sys 2m23.220s
ie. the jpeg2000 decode dominates the whole calculation.
You could make something faster if you only wanted a few tiles. The code here could be a starting point:
https://github.com/jcupitt/tilesrv
I'll leave this issue open as a reminder to reconsider this.
from libvips.
in our use case we always render up to 12 level, all another renders by demand if user zoom to this part of document, many parts of image is not interesting by end user and never need to be tiled.
we have many images and render all of them to max level is overhead by cpu usage and disk space.
from libvips.
Ah, I understand. One option would be to use the options on file load to pick a level out. For example:
$ time vips dzsave 044TracheaEsophCat.svs[level=2] x
real 0m1.924s
user 0m3.972s
sys 0m0.680s
That makes levels 0 - 12, for this image anyway.
dzsave can make a pyramid from any image. If you give it an openslide image, you can give any openslide load options in square brackets after the filename. To see all openslide load options, try:
$ vips openslideload
usage:
openslideload filename out
load file with OpenSlide
where:
filename - Filename to load from, input gchararray
out - Output image, output VipsImage
optional arguments:
flags - Flags for this file, output VipsForeignFlags
disc - Open to disc, input gboolean
level - Load this level from the file, input gint
sequential - Sequential read only, input gboolean
associated - Load this associated image, input gchararray
Online docs here:
from libvips.
OpenSlide looks like a option.
can i convert any image (jpeg, png, etc) to OpenSlide format with vips?
from libvips.
Sorry, I assumed you were working from openslide source images. No, vips cannot write openslide, only read.
You could shrink your image before running dzsave. For example:
vipsthumbnail huge.tif -o medium.tif --size 1500
vips dzsave medium.tif x
Would first shrink the image to fit within 1500 x 1500, then run dzsave on that. This would then only generate the first 12 layers (roughly).
The 1500 is only an approximate number, you'd need to work out an exact figure for each image.
from libvips.
git master has a new feature which might be relevant: you can now save to a deepzoom pyramid with the .dz extension. This lets you do pre-extract or shrink as part of pyramid creation. For example:
vips shrink huge.tif pyramid.dz[layout=google] 10 10
will shrink huge.tif by a factor of 10, then write that shrunk image to a set of tiles using google layout. You could use extract_area to crop out just the centre of the image and tile that.
This will be in the next stable version, due in a couple of weeks.
from libvips.
Related Issues (20)
- VIPS_MAX_COORD prevents `join`/`insert` operations with obscure messages HOT 5
- libvips 8.15.1 thumbnail command on centos 7 is very slower than same version on ubuntu 20.04。 HOT 3
- jpegli support HOT 14
- Small bug with JPEG XL Exif offset handling HOT 1
- vips 8.15.1 build segfaulting with clang HOT 8
- Sampling a random set of pixels. HOT 3
- Vips 8.15.1 build failure on MacOS x86_64 HOT 4
- Writing to multiple output pixels using vips_image_generate HOT 1
- Loading images with jpegli fails with "No SOS marker found." HOT 2
- jxlsave fails with "jxlsave: error JxlEncoderSetBasicInfo" for a 32-bit (?) CMYK colour TIFF HOT 2
- Quality handling in WebP near-lossless (and arguably lossless) mode is incorrect HOT 3
- Conversion to PFM gives incorrect output HOT 2
- Improve `tilecache` performance
- JXL Support in Libvips Web Build HOT 3
- vips: unknown action "dzsave", vips-8.15.1 on Gentoo HOT 1
- Row sums from vips_project do not necessarily give the same value like summing img(i,j) along i HOT 2
- Looks like 8.15.2 tag is wrong? HOT 1
- vips 8.15.2 failed to build with latest xcode HOT 11
- HDR AVIF to HEIC (hdr) HOT 4
- Feature request: Support SDR→HDR via RTX HDR (upmapping / inverse tone mapping)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libvips.