{"id":23157012,"url":"https://github.com/bradh/libheif-jextract","last_synced_at":"2025-04-04T17:44:29.866Z","repository":{"id":214577517,"uuid":"736860132","full_name":"bradh/libheif-jextract","owner":"bradh","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-29T05:18:10.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-17T03:54:00.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bradh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-29T04:58:38.000Z","updated_at":"2023-12-29T05:20:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"225a4d12-cafd-4022-ac78-e512645deb85","html_url":"https://github.com/bradh/libheif-jextract","commit_stats":null,"previous_names":["bradh/libheif-jextract"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradh%2Flibheif-jextract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradh%2Flibheif-jextract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradh%2Flibheif-jextract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradh%2Flibheif-jextract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bradh","download_url":"https://codeload.github.com/bradh/libheif-jextract/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226196,"owners_count":20904464,"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":[],"created_at":"2024-12-17T21:16:08.421Z","updated_at":"2025-04-04T17:44:29.859Z","avatar_url":"https://github.com/bradh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demo for Java 21+ use of libheif - using jextract\n\n## Overview\n\nThis demonstrates how to use [libheif](https://github.com/strukturag/libheif) in Java 21 or later.\n\nIt relies on the [jextract](https://github.com/openjdk/jextract) tool and the [Foreign Function and\nMemory API](https://openjdk.org/jeps/442). It won't work with earlier versions of Java.\n\n## Setup\n\n1. Start with Linux\n1. Install Java 21\n1. Clone this repo\n1. Extract or link the jextract tool into the repo checkout. Use the [pre-built binaries](https://jdk.java.net/jextract/)\n1. Clone [libheif](https://github.com/strukturag/libheif) into the repo checkout.\n\nAt this point you should have a directory tree that looks like this\n\n```txt\n.\n├── build.sh\n├── heifdemo.java\n├── jextract-21\n│   ├── bin\n│   │   ├── ....\n│   ├── conf\n│   │   ├── ....\n│   ├── include\n│   │   ├── ....\n│   ├── legal\n│   │   ├── ....\n│   ├── lib\n│   │   ├── ....\n│   └── release\n├── libheif\n│   ├── appveyor.yml\n│   ├── build-emscripten.sh\n│   ├── cmake\n│   │   └── ....\n│   ├── CMakeLists.txt\n│   ├── CMakePresets.json\n│   ├── COPYING\n│   ├── CPPLINT.cfg\n│   ├── examples\n│   │   ├── ....\n│   ├── extra\n│   │   ├── ....\n│   ├── fuzzing\n│   │   ├── ....\n│   ├── gdk-pixbuf\n│   │   ├── ...\n│   ├── gnome\n│   │   ├── ....\n│   ├── go\n│   │   └── ....\n│   ├── libheif\n│   │   ├── ....\n│   ├── libheif.pc.in\n│   ├── logos\n│   │   └── ....\n│   ├── post.js\n│   ├── README.md\n│   ├── scripts\n│   │   ├── ....\n│   ├── tests\n│   │   ├── ....\n│   └── third-party\n│       ├── ....\n├── libheif.dump\n├── README.md\n└── run.sh\n```\n\n## Build\n\n1. Build libheif. See libheif/README.md in your tree for more instructions\n\n1. Run build.sh. The results of that should look like this:\n\n```txt\nWARNING: A restricted method in java.lang.foreign.AddressLayout has been called\nWARNING: java.lang.foreign.AddressLayout::withTargetLayout has been called by module org.openjdk.jextract\nWARNING: Use --enable-native-access=org.openjdk.jextract to avoid a warning for this module\n\nWARNING: skipping .__clang_max_align_nonce2 because of unsupported type usage: long double\nNote: Some input files use preview features of Java SE 21.\nNote: Recompile with -Xlint:preview for details.\n```\n\n## Run\n\n1. Run run.sh with some sample file. \n\n```sh\nbash ./run.sh libheif/examples/example.heic\n```\n\nThe results of that should look like:\n\n```txt\nNote: heifdemo.java uses preview features of Java SE 21.\nNote: Recompile with -Xlint:preview for details.\n-- Starting HeifDemo --\nlibheif version: 1.17.6\n-- Trying to dump libheif/examples/example.heic --\nBox: ftyp -----\nsize: 28   (header size: 8)\nmajor brand: mif1\nminor version: 0\ncompatible brands: mif1,heic,hevc\n\nBox: meta -----\nsize: 921   (header size: 12)\n| Box: hdlr -----\n| size: 33   (header size: 12)\n| pre_defined: 0\n| handler_type: pict\n| name: \n| \n| Box: pitm -----\n| size: 14   (header size: 12)\n| item_ID: 20004\n| \n| Box: iloc -----\n| size: 88   (header size: 12)\n| item ID: 20004\n|   construction method: 0\n|   data_reference_index: 0\n|   base_offset: 957\n|   extents: 0,333704 \n| item ID: 20005\n|   construction method: 0\n|   data_reference_index: 0\n|   base_offset: 334669\n|   extents: 0,24523 \n| item ID: 20006\n|   construction method: 0\n|   data_reference_index: 0\n|   base_offset: 359200\n|   extents: 0,330132 \n| item ID: 20007\n|   construction method: 0\n|   data_reference_index: 0\n|   base_offset: 689340\n|   extents: 0,28758 \n| \n| Box: iinf -----\n| size: 140   (header size: 12)\n| | Box: infe -----\n| | size: 31   (header size: 12)\n| | item_ID: 20004\n| | item_protection_index: 0\n| | item_type: hvc1\n| | item_name: HEVC Image\n| | content_type: \n| | content_encoding: \n| | item uri type: \n| | hidden item: false\n| | \n| | Box: infe -----\n| | size: 31   (header size: 12)\n| | item_ID: 20005\n| | item_protection_index: 0\n| | item_type: hvc1\n| | item_name: HEVC Image\n| | content_type: \n| | content_encoding: \n| | item uri type: \n| | hidden item: false\n| | \n| | Box: infe -----\n| | size: 31   (header size: 12)\n| | item_ID: 20006\n| | item_protection_index: 0\n| | item_type: hvc1\n| | item_name: HEVC Image\n| | content_type: \n| | content_encoding: \n| | item uri type: \n| | hidden item: false\n| | \n| | Box: infe -----\n| | size: 31   (header size: 12)\n| | item_ID: 20007\n| | item_protection_index: 0\n| | item_type: hvc1\n| | item_name: HEVC Image\n| | content_type: \n| | content_encoding: \n| | item uri type: \n| | hidden item: false\n| \n| Box: iref -----\n| size: 40   (header size: 12)\n| reference with type 'thmb' from ID: 20005 to IDs: 20004 \n| reference with type 'thmb' from ID: 20007 to IDs: 20006 \n| \n| Box: iprp -----\n| size: 594   (header size: 8)\n| | Box: ipco -----\n| | size: 550   (header size: 8)\n| | | Box: hvcC -----\n| | | size: 126   (header size: 8)\n| | | configuration_version: 1\n| | | general_profile_space: 0\n| | | general_tier_flag: 0\n| | | general_profile_idc: 1\n| | | general_profile_compatibility_flags: 0110.0000 0000.0000 0000.0000 0000.0000 \n| | | general_constraint_indicator_flags: 10010000 00000000 00000000 00000000 00000000 00000000 \n| | | general_level_idc: 120\n| | | min_spatial_segmentation_idc: 0\n| | | parallelism_type: 0\n| | | chroma_format: 4:2:0\n| | | bit_depth_luma: 8\n| | | bit_depth_chroma: 8\n| | | avg_frame_rate: 0\n| | | constant_frame_rate: 0\n| | | num_temporal_layers: 1\n| | | temporal_id_nested: 1\n| | | length_size: 4\n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 32\n| | | | 40 01 0c 01 ff ff 01 60 00 00 03 00 90 00 00 03 00 00 03 00 78 99 8a 02 40 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 33\n| | | | 42 01 01 01 60 00 00 03 00 90 00 00 03 00 00 03 00 78 a0 02 80 80 35 9f 59 66 62 a4 91 26 bf fc 1a b0 1a ac 04 00 00 03 00 04 00 00 03 00 64 20 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 34\n| | | | 44 01 c1 72 b6 62 40 \n| | | \n| | | Box: ispe -----\n| | | size: 20   (header size: 12)\n| | | image width: 1280\n| | | image height: 854\n| | | \n| | | Box: hvcC -----\n| | | size: 125   (header size: 8)\n| | | configuration_version: 1\n| | | general_profile_space: 0\n| | | general_tier_flag: 0\n| | | general_profile_idc: 1\n| | | general_profile_compatibility_flags: 0110.0000 0000.0000 0000.0000 0000.0000 \n| | | general_constraint_indicator_flags: 10010000 00000000 00000000 00000000 00000000 00000000 \n| | | general_level_idc: 60\n| | | min_spatial_segmentation_idc: 0\n| | | parallelism_type: 0\n| | | chroma_format: 4:2:0\n| | | bit_depth_luma: 8\n| | | bit_depth_chroma: 8\n| | | avg_frame_rate: 0\n| | | constant_frame_rate: 0\n| | | num_temporal_layers: 1\n| | | temporal_id_nested: 1\n| | | length_size: 4\n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 32\n| | | | 40 01 0c 01 ff ff 01 60 00 00 03 00 90 00 00 03 00 00 03 00 3c 99 8a 02 40 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 33\n| | | | 42 01 01 01 60 00 00 03 00 90 00 00 03 00 00 03 00 3c a0 0a 08 0d 9f 79 66 62 a4 91 26 bf fc 1a 80 1a ac 04 00 00 03 00 04 00 00 03 00 64 20 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 34\n| | | | 44 01 c1 72 b6 62 40 \n| | | \n| | | Box: ispe -----\n| | | size: 20   (header size: 12)\n| | | image width: 320\n| | | image height: 212\n| | | \n| | | Box: hvcC -----\n| | | size: 126   (header size: 8)\n| | | configuration_version: 1\n| | | general_profile_space: 0\n| | | general_tier_flag: 0\n| | | general_profile_idc: 1\n| | | general_profile_compatibility_flags: 0110.0000 0000.0000 0000.0000 0000.0000 \n| | | general_constraint_indicator_flags: 10010000 00000000 00000000 00000000 00000000 00000000 \n| | | general_level_idc: 120\n| | | min_spatial_segmentation_idc: 0\n| | | parallelism_type: 0\n| | | chroma_format: 4:2:0\n| | | bit_depth_luma: 8\n| | | bit_depth_chroma: 8\n| | | avg_frame_rate: 0\n| | | constant_frame_rate: 0\n| | | num_temporal_layers: 1\n| | | temporal_id_nested: 1\n| | | length_size: 4\n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 32\n| | | | 40 01 0c 01 ff ff 01 60 00 00 03 00 90 00 00 03 00 00 03 00 78 99 8a 02 40 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 33\n| | | | 42 01 01 01 60 00 00 03 00 90 00 00 03 00 00 03 00 78 a0 02 80 80 35 9f 59 66 62 a4 91 26 bf fc 1a b0 1a ac 04 00 00 03 00 04 00 00 03 00 64 20 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 34\n| | | | 44 01 c1 72 b6 62 40 \n| | | \n| | | Box: hvcC -----\n| | | size: 125   (header size: 8)\n| | | configuration_version: 1\n| | | general_profile_space: 0\n| | | general_tier_flag: 0\n| | | general_profile_idc: 1\n| | | general_profile_compatibility_flags: 0110.0000 0000.0000 0000.0000 0000.0000 \n| | | general_constraint_indicator_flags: 10010000 00000000 00000000 00000000 00000000 00000000 \n| | | general_level_idc: 60\n| | | min_spatial_segmentation_idc: 0\n| | | parallelism_type: 0\n| | | chroma_format: 4:2:0\n| | | bit_depth_luma: 8\n| | | bit_depth_chroma: 8\n| | | avg_frame_rate: 0\n| | | constant_frame_rate: 0\n| | | num_temporal_layers: 1\n| | | temporal_id_nested: 1\n| | | length_size: 4\n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 32\n| | | | 40 01 0c 01 ff ff 01 60 00 00 03 00 90 00 00 03 00 00 03 00 3c 99 8a 02 40 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 33\n| | | | 42 01 01 01 60 00 00 03 00 90 00 00 03 00 00 03 00 3c a0 0a 08 0d 9f 79 66 62 a4 91 26 bf fc 1a 80 1a ac 04 00 00 03 00 04 00 00 03 00 64 20 \n| | | \u003carray\u003e\n| | | | array_completeness: 0\n| | | | NAL_unit_type: 34\n| | | | 44 01 c1 72 b6 62 40 \n| | \n| | Box: ipma -----\n| | size: 36   (header size: 12)\n| | associations for item ID: 20004\n| | | property index: 1 (essential: true)\n| | | property index: 2 (essential: false)\n| | associations for item ID: 20005\n| | | property index: 3 (essential: true)\n| | | property index: 4 (essential: false)\n| | associations for item ID: 20006\n| | | property index: 5 (essential: true)\n| | | property index: 2 (essential: false)\n| | associations for item ID: 20007\n| | | property index: 6 (essential: true)\n| | | property index: 4 (essential: false)\n\nBox: mdat -----\nsize: 333712   (header size: 8)\n\nBox: mdat -----\nsize: 24531   (header size: 8)\n\nBox: mdat -----\nsize: 330140   (header size: 8)\n\nBox: mdat -----\nsize: 28766   (header size: 8)\n\nBox: mdat -----\nsize: 16   (header size: 8)\n-- Ending HeifDemo --\n```\n\nIf any of that does not work, consult the jextract documentation, and update the scripts as needed.\n\n## License\n\nThis code is covered by the same [license as libheif](https://github.com/strukturag/libheif/blob/master/COPYING).\nThe `heifdemo.java` content is considered sample code.\n\n## Support\n\nOnly under commercial agreement. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradh%2Flibheif-jextract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradh%2Flibheif-jextract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradh%2Flibheif-jextract/lists"}