Created
July 30, 2021 22:17
-
-
Save mateon1/a6aab9372878b22c2021b10aa8d3b9f8 to your computer and use it in GitHub Desktop.
Kaitai XCF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| meta: | |
| id: gimp_xcf | |
| file-extension: xcf | |
| xref: | |
| justsolve: XCF | |
| pronom: fmt/615 | |
| mime-type: image/x-xcf | |
| mime-type: image/xcf | |
| wikidata: Q261907 | |
| encoding: utf8 | |
| endian: be | |
| doc-ref: http://henning.makholm.net/xcftools/xcfspec-saved | |
| doc-ref: https://gitlab.gnome.org/GNOME/gimp/-/blob/master/devel-docs/xcf.txt | |
| seq: | |
| - id: magic | |
| contents: "gimp xcf " | |
| - id: version | |
| type: str | |
| size: 4 | |
| - id: magic_nul | |
| contents: [0] | |
| - id: canvas_width | |
| type: u4 | |
| - id: canvas_height | |
| type: u4 | |
| - id: base_type | |
| type: u4 | |
| enum: base_type | |
| - id: precision | |
| type: u4 | |
| if: numeric_version >= 4 | |
| - id: properties | |
| type: prop | |
| repeat: until | |
| repeat-until: _.end | |
| - id: layer_refs | |
| type: layer_ref | |
| repeat: until | |
| repeat-until: _.end | |
| - id: channel_refs | |
| type: channel_ref | |
| repeat: until | |
| repeat-until: _.end | |
| instances: | |
| numeric_version: | |
| value: 'version == "file" ? 0 : version.substring(1, 4).to_i' | |
| types: | |
| string: | |
| seq: | |
| - id: length | |
| type: u4 | |
| - id: data | |
| type: strz | |
| size: length | |
| -webide-representation: '"{data}"' | |
| pointer: | |
| seq: | |
| - id: pointer | |
| # up to version v010 pointers were 4 bytes | |
| type: | |
| switch-on: _root.numeric_version <= 10 | |
| cases: | |
| true: u4 | |
| false: u8 | |
| prop: | |
| instances: | |
| end: | |
| value: type == prop_type::prop_end | |
| seq: | |
| - id: type | |
| type: u4 | |
| enum: prop_type | |
| - id: length | |
| type: u4 | |
| - id: data | |
| size: length | |
| -webide-representation: "{type}" | |
| layer_ref: | |
| instances: | |
| end: | |
| value: ptr.pointer == 0 | |
| ref: | |
| pos: ptr.pointer | |
| type: layer | |
| if: not end | |
| seq: | |
| - id: ptr | |
| type: pointer | |
| channel_ref: | |
| instances: | |
| end: | |
| value: ptr.pointer == 0 | |
| ref: | |
| pos: ptr.pointer | |
| type: channel | |
| if: not end | |
| seq: | |
| - id: ptr | |
| type: pointer | |
| hierarchy_ref: | |
| instances: | |
| end: | |
| value: ptr.pointer == 0 | |
| ref: | |
| pos: ptr.pointer | |
| type: hierarchy | |
| if: not end | |
| seq: | |
| - id: ptr | |
| type: pointer | |
| level_ref: | |
| instances: | |
| end: | |
| value: ptr.pointer == 0 | |
| ref: | |
| pos: ptr.pointer | |
| type: level | |
| if: not end | |
| seq: | |
| - id: ptr | |
| type: pointer | |
| dummy_level_ref: | |
| instances: | |
| end: | |
| value: ptr.pointer == 0 | |
| ref: | |
| pos: ptr.pointer | |
| type: dummy_level | |
| if: not end | |
| seq: | |
| - id: ptr | |
| type: pointer | |
| level: | |
| seq: | |
| - id: width | |
| type: u4 | |
| - id: height | |
| type: u4 | |
| - id: tile_ptrs | |
| type: pointer | |
| repeat: until | |
| repeat-until: _.pointer == 0 | |
| dummy_level: | |
| seq: | |
| - id: width | |
| type: u4 | |
| - id: height | |
| type: u4 | |
| - id: tile_ptrs | |
| type: u4 | |
| repeat: until | |
| repeat-until: _ == 0 | |
| hierarchy: | |
| seq: | |
| - id: width | |
| type: u4 | |
| - id: height | |
| type: u4 | |
| - id: bpp | |
| type: u4 | |
| - id: level_ref | |
| type: level_ref | |
| - id: dummy_level_refs | |
| type: dummy_level_ref | |
| repeat: until | |
| repeat-until: _.end | |
| channel: | |
| seq: | |
| - id: width | |
| type: u4 | |
| - id: height | |
| type: u4 | |
| - id: name | |
| type: string | |
| - id: properties | |
| type: prop | |
| repeat: until | |
| repeat-until: _.end | |
| - id: hierarchy_ref | |
| type: hierarchy_ref | |
| layer: | |
| seq: | |
| - id: width | |
| type: u4 | |
| - id: height | |
| type: u4 | |
| - id: type | |
| type: u4 | |
| - id: name | |
| type: string | |
| - id: properties | |
| type: prop | |
| repeat: until | |
| repeat-until: _.end | |
| - id: hierarchy_ref | |
| type: hierarchy_ref | |
| - id: mask_ref | |
| type: channel_ref | |
| enums: | |
| base_type: | |
| 0: rgb_color | |
| 1: grayscale | |
| 2: indexed_color | |
| prop_type: | |
| 0: prop_end | |
| 1: prop_colormap | |
| 2: prop_active_layer | |
| 3: prop_active_channel | |
| 4: prop_selection | |
| 5: prop_floating_selection | |
| 6: prop_opacity | |
| 7: prop_mode | |
| 8: prop_visible | |
| 9: prop_linked | |
| 10: prop_lock_alpha | |
| 11: prop_apply_mask | |
| 12: prop_edit_mask | |
| 13: prop_show_mask | |
| 14: prop_show_masked | |
| 15: prop_offsets | |
| 16: prop_color | |
| 17: prop_compression | |
| 18: prop_guides | |
| 19: prop_resolution | |
| 20: prop_tattoo | |
| 21: prop_parasites | |
| 22: prop_unit | |
| 23: prop_paths | |
| 24: prop_user_unit | |
| 25: prop_vectors | |
| 26: prop_text_layer_flags | |
| 27: prop_old_sample_points | |
| 28: prop_lock_content | |
| 29: prop_group_item | |
| 30: prop_item_path | |
| 31: prop_group_item_flags | |
| 32: prop_lock_position | |
| 33: prop_float_opacity | |
| 34: prop_color_tag | |
| 35: prop_composite_mode | |
| 36: prop_composite_space | |
| 37: prop_blend_space | |
| 38: prop_float_color | |
| 39: prop_sample_points |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment