{"id":20673703,"url":"https://github.com/cpg314/png-achunk","last_synced_at":"2025-07-17T16:37:07.069Z","repository":{"id":208050249,"uuid":"720711071","full_name":"cpg314/png-achunk","owner":"cpg314","description":"Encode and decode custom binary chunks in PNG images","archived":false,"fork":false,"pushed_at":"2025-02-26T07:57:04.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T08:04:47.535Z","etag":null,"topics":["encoding-decoding","png","rust"],"latest_commit_sha":null,"homepage":"https://c.pgdm.ch/code","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpg314.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-11-19T11:07:51.000Z","updated_at":"2025-02-26T07:57:08.000Z","dependencies_parsed_at":"2023-11-19T12:24:52.043Z","dependency_job_id":"c4da51d8-a269-40ac-bb54-2cb716333d9c","html_url":"https://github.com/cpg314/png-achunk","commit_stats":null,"previous_names":["cpg314/png-achunk"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpng-achunk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpng-achunk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpng-achunk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpng-achunk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpg314","download_url":"https://codeload.github.com/cpg314/png-achunk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480446,"owners_count":21110939,"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":["encoding-decoding","png","rust"],"created_at":"2024-11-16T20:42:18.696Z","updated_at":"2025-04-13T17:13:31.771Z","avatar_url":"https://github.com/cpg314.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"This library allows encoding and decoding custom chunks in PNG images.\n\nThese chunks can contain arbitrary binary data (of length at most 2^32-1), placed before or after image data.\n\nIf they are properly marked as ancillary (see [PNG specification, section 11.3](https://www.w3.org/TR/png/#11Ancillary-chunks)), good decoders will simply ignore them.\n\nCurrently, the encoder always places the custom chunks before the image data, which allows reading them without even decoding the image.\n\n## Usage\n\n### Rust\n\nThe [`Encoder`] struct implements the [`image::ImageEncoder`] trait, so that it can be used to encode [`image::DynamicImage`] images:\n\n```rust\n// Create custom chunk\n// The name implies that this is a private non-critical chunk that is safe to copy\n// only when non-critical chuks have not been modified.\nlet chunk_type = png_achunk::ChunkType::from_ascii(\u0026\"teST\")?;\nlet chunk = png_achunk::Chunk::new(chunk_type, vec![4, 5, 6])?;\n// Encode an `image::DynamicImage`\nimage.write_with_encoder(\n    png_achunk::Encoder::new_to_file(\"test.png\")?.with_custom_chunk(chunk.clone()),\n)?;\n```\n\nFor decoding:\n\n```rust\n// Decode image and ancillary chunks\nlet (image, chunks) = png_achunk::Decoder::from_file(\"test.png\")?.decode_all()?;\n// Decode ancillary chunks without reading the image data\nlet chunks = png_achunk::Decoder::from_file(\"test.png\")?.decode_ancillary_chunks()?;\n```\n\n### Python\n\nOnly a primitive interface is implemented at the moment.\n\nFirst, copy `target/release/libpng_achunk_py.so` to `png_achunk.so`.\n\n```python\nimport png_achunk\nchunk = png_achunk.read_chunk(\"test.png\", \"teST\")\n```\n\n### C\n\nOnly a primitive interface is implemented at the moment.\n\nThe example in `c/test.c` can be compiled with\n\n```\n$ gcc test.c -L. -l:libpng_achunk.a -lm -o test\n```\n\n## Implementation\n\nPNG encoding and decoding use the [`png`] crate. For decoding, we need to decode ancillary chunks manually as [`png::Decoder`] does not expose them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg314%2Fpng-achunk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpg314%2Fpng-achunk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg314%2Fpng-achunk/lists"}