Can't extract smallest level
Closed this issue · 8 comments
Looking at a zif file with 6 levels, the smallest level (level 5, 1 tile) does not extract correctly. It looks like the position and size offsets returned by getTilesInfos()
are preposterously high. (I'll investigate this from the C# side as well.)
Interesting! Do you have a link to this ZIF file?
Oh yes, I think I know what's going on!
I've tried several from the site I sent you earlier. Here's one: http://goo.gl/PRzLDz
I didn't notice this earlier because, like you, I was more interested in the bigger images!
The tile sizes tag doesn't have the same signification when there are less then 3 tiles in the tier. I am going to update the documentation.
Here it is, I fixed the doc: https://github.com/lovasoa/ZIF#note-about-tag-325-0x45-0x01
You're very fast! I was just getting back from dinner and diving into the zoomify js.
Two questions for you:
- Where did you get
MAX_HEAD_SIZE
of 2000? The zoomify source seems to use 8192. - The bitwise operations in
getTileSizes()
are not what I expected. I used the equivalent of
[tagval & 0xFFFFFFFF, tagval >>> 32]
MAX_HEAD_SIZE
Looks like you're right. I'm going to change that.
bitwise operations
Yes, your bitwise operations are correct in a language that handles 64 bits integers correctly. Unfortunately, that's not the case of javascript.
In javascript, you can only apply bitwise operations to numbers that can be stored on 32 bits. When you try to apply a bitwise operator to a larger value, it's converted to an int (32 bits) first. That's why num | 0
, that looks like a no-op, is actually like (int32) num
in other languages.
>>>
is a bitwise operation too, so I cannot apply it to a number larger than 2^32. In js, n >>> 32
always returns 0
. So, I have to do an operation that works on floating point numbers (that's how large integers are stored in javascript). That's why I do tagval / 0x100000000 | 0
.
Thanks for the int lesson – I didn't know that about javascript.