{"id":13463216,"url":"https://github.com/wvanbergen/chunky_png","last_synced_at":"2025-05-14T01:08:48.263Z","repository":{"id":772349,"uuid":"457743","full_name":"wvanbergen/chunky_png","owner":"wvanbergen","description":"Read/write access to PNG images in pure Ruby.","archived":false,"fork":false,"pushed_at":"2024-06-03T10:22:43.000Z","size":1252,"stargazers_count":1056,"open_issues_count":16,"forks_count":103,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-05-10T12:37:24.824Z","etag":null,"topics":["chunkypng","png","png-decoder","png-encoder","rdoc"],"latest_commit_sha":null,"homepage":"https://chunkypng.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kubernetes/heapster","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wvanbergen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rdoc","contributing":"CONTRIBUTING.rdoc","funding":null,"license":"LICENSE","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":"2010-01-04T06:56:19.000Z","updated_at":"2025-05-06T20:52:22.000Z","dependencies_parsed_at":"2024-11-05T19:02:34.895Z","dependency_job_id":null,"html_url":"https://github.com/wvanbergen/chunky_png","commit_stats":{"total_commits":538,"total_committers":39,"mean_commits":"13.794871794871796","dds":"0.22676579925650553","last_synced_commit":"7a1faf62f10b12ad3170d563b998db7893eda845"},"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanbergen%2Fchunky_png","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanbergen%2Fchunky_png/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanbergen%2Fchunky_png/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanbergen%2Fchunky_png/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wvanbergen","download_url":"https://codeload.github.com/wvanbergen/chunky_png/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253568691,"owners_count":21928909,"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":["chunkypng","png","png-decoder","png-encoder","rdoc"],"created_at":"2024-07-31T13:00:48.285Z","updated_at":"2025-05-14T01:08:48.193Z","avatar_url":"https://github.com/wvanbergen.png","language":"Ruby","funding_links":[],"categories":["Graphics","Ruby","Imagery","1. language"],"sub_categories":["Image Processing","1.1 ruby"],"readme":"# ChunkyPNG\n\nThis library can read and write PNG files. It is written in pure Ruby for\nmaximum portability. Let me rephrase: it does NOT require RMagick or any other\nmemory leaking image library.\n\n- [Source code](https://github.com/wvanbergen/chunky_png/tree/master)\n- [RDoc](https://rdoc.info/gems/chunky_png)\n- [Wiki](https://github.com/wvanbergen/chunky_png/wiki)\n- [Issue tracker](https://github.com/wvanbergen/chunky_png/issues)\n\n## Features\n\n- Decodes any image that the PNG standard allows. This includes all standard\n  color modes, all bit depths, all transparency, and interlacing and filtering\n  options.\n- Encodes images supports all color modes (true color, grayscale, and indexed)\n  and transparency for all these color modes. The best color mode will be\n  chosen automatically, based on the amount of used colors.\n- R/W access to the image's pixels.\n- R/W access to all image metadata that is stored in chunks.\n- Memory efficient (uses a Fixnum, i.e. 4 or 8 bytes of memory per pixel,\n  depending on the hardware)\n- Reasonably fast for Ruby standards, by only using integer math and a highly\n  optimized saving routine.\n- Works on every currently supported Ruby version (2.5+)\n- Interoperability with RMagick if you really have to.\n\nAlso, have a look at [OilyPNG](https://github.com/wvanbergen/oily_png) which\nis a mixin module that implements some of the ChunkyPNG algorithms in C, which\nprovides a massive speed boost to encoding and decoding.\n\n## Usage\n\n```ruby\nrequire 'chunky_png'\n\n# Creating an image from scratch, save as an interlaced PNG\npng = ChunkyPNG::Image.new(16, 16, ChunkyPNG::Color::TRANSPARENT)\npng[1,1] = ChunkyPNG::Color.rgba(10, 20, 30, 128)\npng[2,1] = ChunkyPNG::Color('black @ 0.5')\npng.save('filename.png', :interlace =\u003e true)\n\n# Compose images using alpha blending.\navatar = ChunkyPNG::Image.from_file('avatar.png')\nbadge  = ChunkyPNG::Image.from_file('no_ie_badge.png')\navatar.compose!(badge, 10, 10)\navatar.save('composited.png', :fast_rgba) # Force the fast saving routine.\n\n# Accessing metadata\nimage = ChunkyPNG::Image.from_file('with_metadata.png')\nputs image.metadata['Title']\nimage.metadata['Author'] = 'Willem van Bergen'\nimage.save('with_metadata.png') # Overwrite file\n\n# Low level access to PNG chunks\npng_stream = ChunkyPNG::Datastream.from_file('filename.png')\npng_stream.each_chunk { |chunk| p chunk.type }\n```\n\nAlso check out the screencast on the ChunkyPNG homepage by John Davison,\nwhich illustrates basic usage of the library on the [ChunkyPNG\nwebsite](https://chunkypng.com/).\n\nFor more information, see the [project\nwiki](https://github.com/wvanbergen/chunky_png/wiki) or the [RDOC\ndocumentation](https://www.rubydoc.info/gems/chunky_png).\n\n## Security warning\n\nChunkyPNG is vulnerable to decompression bombs, which means that ChunkyPNG is\nvulnerable to DOS attacks by running out of memory when loading a specifically\ncrafted PNG file. Because of the pure-Ruby nature of the library it is very hard\nto fix this problem in the library itself.\n\nIn order to safely deal with untrusted images, you should make sure to do the\nimage processing using ChunkyPNG in a separate process, e.g. by using fork or a\nbackground processing library.\n\n## About\n\nThe library is written by Willem van Bergen for Floorplanner.com, and released\nunder the MIT license (see LICENSE). Please contact me for questions or\nremarks.\n\nI generally consider this library to be feature complete. I will gladly accept\npatches to fix bugs and improve performance, but I will generally be hesitant\nto accept new features or API endpoints. Before contributing, please read\n[CONTRIBUTING.rdoc](CONTRIBUTING.rdoc) that explains this in more detail.\n\nPlease check out CHANGELOG.rdoc to see what changed in all versions.\n\nP.S.: The name of this library is intentionally similar to Chunky Bacon and\nChunky GIF. Use Google if you want to know _why_. :-)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvanbergen%2Fchunky_png","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwvanbergen%2Fchunky_png","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvanbergen%2Fchunky_png/lists"}