-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support tile overlap for DZI #2
Comments
Shouldn't the default be 256 instead of 254? So definitely some inconsistency. |
Well, I actually don't know to what extent it matters these days, but general graphics programming wisdom is you try to keep your tiles at or under powers of 2. So a 256 tile size would be perfect if you had no overlap. With overlap, however, it makes the tiles bigger, so a middle tile with TileSize="256" and Overlap="1" would have a width of 258, just 2 pixels over the power of 2 (and therefore theoretically less efficient for the GPU). That's why I suggest 254/1, which would produce a max actual tile size of 256. Does that make sense? And yes, perhaps we should figure out if it really matters and come up with some official recommendations we can post somewhere, because obviously the data out there is pretty random. |
Thanks for the clarification. |
Yes, but now I can't add overlap, because imagemagick have very specific options for it and overlapping can be done only with perfect size images (power of zoom for each image side). IM can do overlap only for number of tiles for each side. It mean, if image not perfect size - tile size can't be controled. Also, official DZI format support only square images. But, OSD support any size ^_^ |
http://www.imagemagick.org/Usage/crop/#crop_spaced - here is imagemagick overlap options manual. |
Actually, you can use ImageMagick to pull any arbitrary portion of an image out. You just do the math for what portion you need and then tell it to grab that part. For instance, if you want to grab a 200x200 pixel square starting at 100px down from the top and 100px in from the left, use:
With this technique you can support overlap. |
Yes, I know this — I read documentation. I have very strange result — few small tiles with many numbers names. |
Should just be a matter of sorting out your logic. I think right now you're having it tile automatically, right? With this technique you would have to do the math for each tile. |
Hello, libvips recently and painfully revised overlap handling to match the DZI spec. The issue here has the discussion: https://github.com/jcupitt/libvips/issues/795 There are a lot of useful links (and some nice posts from the original dzi developers) describing the details of tile layout. It might be helpful. |
Specified in pixels. Default should be 1. Default tileSize should be 254.
Overlap is added to the size of a tile. So, a middle tile (with neighbors on all sides) with a tileSize of 254 and an overlap of 1 would have an actual size of 256 (254 + 1 for each side). A tile on the edge (with only 1 neighbor) would have an actual size of 255 (254 + the one neighbor side).
Each overlap row or column is basically taken from the side of the neighboring tile. It's like you sliced all the tiles up without overlap, but then just added rows and columns of pixels from each neighboring tile.
The text was updated successfully, but these errors were encountered: