{"id":18694492,"url":"https://github.com/luickk/zig-png-decoder","last_synced_at":"2025-07-11T18:33:51.947Z","repository":{"id":43635743,"uuid":"510442833","full_name":"luickk/zig-png-decoder","owner":"luickk","description":"Very basic png decoder ","archived":false,"fork":false,"pushed_at":"2022-07-19T08:37:47.000Z","size":2465,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T21:13:42.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"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/luickk.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}},"created_at":"2022-07-04T17:11:13.000Z","updated_at":"2022-07-06T11:24:00.000Z","dependencies_parsed_at":"2022-09-16T02:12:26.121Z","dependency_job_id":null,"html_url":"https://github.com/luickk/zig-png-decoder","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/luickk%2Fzig-png-decoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luickk%2Fzig-png-decoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luickk%2Fzig-png-decoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luickk%2Fzig-png-decoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luickk","download_url":"https://codeload.github.com/luickk/zig-png-decoder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239552507,"owners_count":19657924,"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-11-07T11:10:59.807Z","updated_at":"2025-02-18T21:26:03.658Z","avatar_url":"https://github.com/luickk.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig Png Decoder\n\nThis lib provides a minimal parser that supports truecolor and truecolor_alpha color types en/decode and all critical chunks. For compression,filtering or pass extraction only  basic methods are supported.\n\nThe lib also contains a deflate compressor (`src/compressor`) which has not been implemented by me, but has been taken from the current master of the zig std lib, since the current version of the zig std did not work correctly(caused memory leaks which could not be fixed).\nThe master branches zlib also only supported zlib stream decoding, but no encoding. My own implementation can be found in `src/zlibStreamEnc.zig` and only supports basic deflate, which conforms with RFC 1950 wihtout dict.\n\n## Tests\n\nThere are unit tests for all modules which can be run with `zig test`, as well as integration tests (with samples) `zig itest`. The results of the 3 integration tests (simple encode, simple decode, encode decode) can be checked out in `test/test_imgs/res`.\n\n## Examples\n\nDecoding:\n\n```zig\nvar file = try std.fs.cwd().openFile(\"test/test_imgs/test.png\", .{});\ndefer file.close();\n\nvar buf_reader = std.io.bufferedReader(file.reader());\nvar in_stream = buf_reader.reader();\n\nvar decoder = PngDecoder.PngDecoder(@TypeOf(in_stream)).init(std.testing.allocator, in_stream);\ndefer decoder.deinit();\n\nvar img = try decoder.parse();\n\nvar bm_buff = try img.bitmap_reader.readAllAlloc(std.testing.allocator, std.math.maxInt(usize));\n```\n\nEncoding:\n\n```zig\n// contains the raw bitmap of test_imgs/test2.png\nconst test_bm = @import(\"test/test_imgs/test2_bm.zig\");\n\nvar test_img_bm = @bitCast([]u8, std.mem.sliceAsBytes(\u0026test_bm.img_bm));\nvar test_replic = try std.fs.cwd().createFile(\"res.png\", .{});\ndefer test_replic.close();\n\ntry pngEncoder.encodePng(std.testing.allocator, test_replic.writer(), test_img_bm, magicNumbers.ColorType.truecolor_alpha, 50, 50, 8);\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluickk%2Fzig-png-decoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluickk%2Fzig-png-decoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluickk%2Fzig-png-decoder/lists"}