{"id":17930565,"url":"https://github.com/lovasoa/zif","last_synced_at":"2025-03-24T04:31:21.947Z","repository":{"id":35723864,"uuid":"40002143","full_name":"lovasoa/ZIF","owner":"lovasoa","description":"zif file format documantation and tools","archived":false,"fork":false,"pushed_at":"2020-03-28T21:44:20.000Z","size":18,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T01:59:48.177Z","etag":null,"topics":["file-format","image","tiff","tile","zoomify"],"latest_commit_sha":null,"homepage":"http://lovasoa.github.io/ZIF/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lovasoa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-31T11:25:00.000Z","updated_at":"2024-04-13T23:03:26.000Z","dependencies_parsed_at":"2022-08-26T08:31:21.702Z","dependency_job_id":null,"html_url":"https://github.com/lovasoa/ZIF","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasoa%2FZIF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasoa%2FZIF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasoa%2FZIF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasoa%2FZIF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovasoa","download_url":"https://codeload.github.com/lovasoa/ZIF/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245211104,"owners_count":20578349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-format","image","tiff","tile","zoomify"],"created_at":"2024-10-28T21:14:13.949Z","updated_at":"2025-03-24T04:31:21.718Z","avatar_url":"https://github.com/lovasoa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e **Edit from 2020** : I was recently made aware that the [ZIF file format](https://zif.photo/) is in fact a subset of [BigTiff](https://www.awaresystems.be/imaging/tiff/bigtiff.html). For end users, what this means is that it can easily be opened by many image viewing and manipulation softwares (such as [GIMP](https://www.gimp.org/)) by simply changing the file extension from `.zif` to `.tiff`.\n\n# ZIF\nzoomify ZIF (ZoomifyImageFormat) file format documentation and tools.\n\n# Tools\n## ZIF.js\nThis repository hosts a [implementation of the format in Ecmascript6](https://github.com/lovasoa/ZIF/blob/master/ZIF.es6). You can try it online here: http://lovasoa.github.io/ZIF/.\n\n## Zif.reader\n[@asherber](https://github.com/asherber) wrote a parser class for the format in C#, under the GPL. You can find it here: https://github.com/asherber/Zif.Reader\n\n# About the format\n\nThe ZIF file format is used by zoomify as a single-file zoomable image format.\nA zif file represents a single image. It contains JPEG *tiles*, little square images that represent a part of the image at a given zoom level, as well as meta-information about how the tiles are organized. [More about the concept behind zoomify](https://msdn.microsoft.com/en-us/library/cc645050%28VS.95%29.aspx).\n\n![AN image and its tiles](http://www.zoomify.com/downloads/screenshots/tiledTiered.jpg)\n\n# ZIF file format documentation\nI have partially reverse-engineered the format. Here is what I found.\n\n### Data types\nAll numbers are stored in [**little endian**](https://en.wikipedia.org/wiki/Endianness) (the number `0xABCD` is sored as `0xCD 0xAB`).\n\nTerm         | Signification\n-------------|---------------\nlong         | 8 bytes unsigned int (uint64)\nint          | 4 bytes unsigned int (uint32)\nshort        | 2 bytes unsigned int (uint16)\npointer      | a *long* representing an offset in bytes from the beginning of the file\n\n## Header\n\n### Magic bytes\nThe first 16 bytes of the file are always\n```\n49 49 2B 00 08 00 00 00\n```\n\n### Metadata\nMeta-data start at offset `0x8` in the file.\nThere is a set of metadata for every zoom level (tier).\n\n#### Zoomlevel metadata\nEach set of metadata starts with a long **pointer** to a long number representing the number of tags (single metadata) in the zoom level. Usually this is a pointer to the offset `n + 8`, where `n` is the offset in bytes of the beggining of the metadata set (so, most often `*n == n+8`). Then, the real metadata start right after the metadata count (at `*n + 8`, which is usually equal to `n + 16`).\n\nThe last zoomlevel has its pointer to the next zoomlevel set to `0`.\n\nEach tag is 20 bytes long.\n\nOffset (from the start of the tag) | Length (in bytes) | Data\n-----------------------------------|-------------------|------------------------------\n0                                  | 2 (short)         | Magic number identifying the tag type\n2                                  | 2                 | Unknown (but not null)\n4                                  | 8  (long)         | **value 1**\n12                                 | 8  (long)         | **value 2**\n\n##### Tag types\nMagic number in decimal | Magic bytes | Signification of **value 1** | Signification of **value 2**\n-----|---|---|---\n256  |`0x00 0x01`| ?                        | Image width at this zoomlevel\n257  |`0x01 0x01`| ?                        | Image height at this zoomlevel\n322  |`0x42 0x01`| ?                        | Tile width\n323  |`0x43 0x01`| ?                        | Tile height\n324  |`0x44 0x01`| Number of tiles          | Pointer to the **tile offsets index** (*see note below*)\n325  |`0x45 0x01`| Number of tiles          | Pointer to the **tile sizes index** (*see note below*)\n\n#### Note about tag 324 (tile offsets index pointer)\nFor tag 324, if value1 is 1 (there is only 1 tile in the zoomlevel), then **value2**\nis not a pointer to a tile offsets index, but a tile index directly.\n\n#### Note about tag 325 (tile sizes index pointer)\nFor tag 325, if value1 is inferior to 3 (there are only 1 or 2 tiles in the tier),\nthen **value2** is not a pointer to the tile sizes index, but is split in two int\nvalues, representing the JPEG tile sizes in bytes directly. It is then as if the\ntile sizes index were at the offset of **value2**.\n\n### Tile offsets index\nSimple list of pointers (8 bytes file offsets) to the beginning of tiles. Each tile is a simple JPEG file.\n\n### Tile sizes index\nSimple list of *int*s indicating tile sizes (in bytes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasoa%2Fzif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovasoa%2Fzif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasoa%2Fzif/lists"}