-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Added DeepZoom support #146
Conversation
Hi Victor, thanks for adding this useful new feature.
Please can you rename the slightly generic sounding The pre-compiled libvips-dev packages for the latest stable Debian/Ubuntu releases don't include the libgsf-1-dev dependency so it's probably best to wrap the use of the Are you able to update the preinstall.sh script with the new dependencies on libgsf-1-dev for Debian-based and libgsf-devel for RHEL-based Linux? Once you're happy with the above, please can you change the destination of your PR to the Finally, and most importantly, please can you add yourself to the list of contributors in package,json as you deserve it. Cheers, |
@@ -679,6 +684,15 @@ class ResizeWorker : public NanAsyncWorker { | |||
return Error(baton, hook); | |||
} | |||
baton->outputFormat = "tiff"; | |||
} else if (outputDzi || (matchInput && inputImageType == ImageType::DZI)) { | |||
#if (VIPS_MAJOR_VERSION >= 7 && VIPS_MINOR_VERSION >= 41) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sharp currently requires libvips 7.40.0+, which I believe provides all the API needed for vips_dzsave
, so this #if
directive can probably be removed.
I've added the first version of a guide to help contributors. |
Great, thank you for your feedback. I 'll send you a new pull request once I have everything ironed out, Victor On Fri, Jan 9, 2015 at 10:30 AM, Lovell Fuller [email protected]
Victor Mateevitsi |
I'm about to merge all the v0.9.0 code into master ahead of the next major release. I'll create a |
Great, thank you. It is almost done, I just got tangled up in some other things I need to get Victor On Fri, Jan 23, 2015 at 4:50 AM, Lovell Fuller [email protected]
Victor Mateevitsi |
Hi, tiny idea: instead of testing if (vips_type_find("VipsOperation", "dzsave")) {
... we have vips_dzsave() available
}
I notice http://www.vips.ecs.soton.ac.uk/supported/7.42/doc/html/libvips/VipsObject.html#vips-type-find |
Thanks @jcupitt, that's a very useful method. |
Thank you @jcupitt, I was a little busy with On Thu, Feb 12, 2015 at 7:10 AM, Lovell Fuller [email protected]
Victor Mateevitsi |
Just sent a new pull request. On Thu, Feb 12, 2015 at 12:20 PM, Victor Mateevitsi [email protected]
Victor Mateevitsi |
@jcupitt, is there a way that I can find out if vips was compiled with openslide support? What I am trying to do is extend the preinstall.sh a script so that it checks whether vips was compiled with openslide support. If not, it downloads and recompiles vips. |
@mvictoras yes, the operator is called
or from C: if (vips_type_find("VipsOperation", "openslideload")) {
... we have vips_openslideload() available
} |
1e2d6c7
to
a7615ab
Compare
Ok I squahed into a single commit and updated with everything that we talked about. |
Regarding the preinstall script I have added and tested the openslide support for all the Operating Systems, except from the Mac OSX with Macports and Amazon cloud, since I don't have access to any of those. It would be great, if you can check if it is working on your machines! |
@@ -501,6 +534,14 @@ Sharp.prototype.toFormat = function(format) { | |||
}; | |||
|
|||
/* | |||
Force DZI output | |||
*/ | |||
Sharp.prototype.dzi = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need dzi()
given dz()
exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably missed that with the merge and squash. Thanks!
Looking great, thanks Victor. I've added a few comments inline - now to verify the much-improved script on a few different OSs. |
@@ -57,6 +60,14 @@ or run the following as `root`: | |||
|
|||
curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | bash - | |||
|
|||
To enable OpenSlide, add the --with-openslide argument: | |||
|
|||
> curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh --with-openslide | sudo bash - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to run this as:
curl -s https://raw.githubusercontent.com/mvictoras/sharp/master/preinstall.sh | sudo bash -s -- --with-openslide
to pass the --with-openslide
parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I will fix that.
I was expecting to see the use of |
brew install homebrew/science/vips --with-webp --with-graphicsmagick --with-openslide | ||
else | ||
brew install homebrew/science/vips --with-webp --with-graphicsmagick | ||
fi | ||
elif type "port" > /dev/null; then | ||
echo "Installing libvips via MacPorts" | ||
port install vips |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check what happens if openslide is enabled? Does vips gets installed with openslide support or not? I don't have Macports so I cannot test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the version of libvips installed via MacPorts already includes openslide support. (But it does seem to be missing WebP!)
Since we are not dealing with openslide as a buffer, I believe vips_openslideload is not needed. So for example, if we are converting from openslide to png: |
Added OpenSuse 13.1 and 13.2 support in preinstall.sh script. Added OpenSlide support in preinstall script. Added unit tests for Deep Zoom and OpenSlide.
I also committed all the changes and fixes, so now you have a clean pull request. |
With or without openslide on any given machine, these new Aperio SVS test files are accepted/parsed by libvips' existing TIFF file loader, so the current version of sharp already supports them; bonus! Do you have a requirement to process files in formats only openslide can understand (but libvips' existing tiff/jpeg etc. loaders cannot), perhaps MIRAX? I suspect these won't work without the addition of |
Hmm, that shouldn't happen, you must test for openslide before tiff. Most of the openslide formats use tiff as the wrapper, but opening with libtiff will miss most of the image. There should be a priority system. Openslide is highest priority, then vips's libtiff loader, then the imagemagick loader (which can also load tiff, but very badly) right at the bottom of the pile. Openslide will refuse to load regular tiffs. It checks the VENDOR tag. |
Thanks @jcupitt , sharp uses libvips' per-format loaders so currently has it's own priority. @mvictoras I will merge in your sterling work to a new WIP branch locally and make this loading-priority change later today. I found a MIRAX sample to test with too. Hopefully everything will... slide... into place very soon. |
This PR is merged to the |
@mvictoras Are you able to help test the new npm install lovell/sharp#judgement In commit 5781a23 I made a small public API change to combine Please open a new issue for any problems you discover. Thanks! |
I have been busy, but am testing and have found some bugs. Victor On Thu, Mar 12, 2015 at 10:50 AM, Lovell Fuller [email protected]
Victor Mateevitsi |
I have been testing the judgement branch and has been working for me just fine until now.
returns false and therefore cannot open the file. It happens in general with smaller .ndpi files. Did not have a chance to investigate, so don't know why this is happening. The other issue I had was with file naming. @jcupitt will probably know more about it. to save the image to DeepZoom file format and pass the filename without the extension as the "name" argument. What I found out is that if the filename contains periods, then vips_dzsave breaks. What happens is easier to explain with an example: Let's say I am converting "this_is_a_test_file.03.08.14.ndpi" and I am passing as the name argument "this_is_a_test_file.03.08.14". Directory this_is_a_test_file.03.08.14 gets correctly created however inside the directory ".14" gets clipped from the filenames, so we only have: When conversion is done, I get the error: So obviously, it thinks that ".40" is the extension, which is not! Any ideas? |
The default value of https://github.com/lovell/sharp/blob/judgement/src/resize.cc#L807 is removing the |
Default limit of 14-bit dimensions remains
ae96814 should alleviate the limitInputPixels problem. You'll need to manually call that method with a new maximum value, but it no longer has a hard upper limit. |
a065580 should fix the problem with filenames that contain dots. sharp v0.10.0 will be published in the next few days, thanks again for your help @mvictoras. |
Added DZI as supported output format. Openslide is a prerequisite for this to work.