{"id":15393314,"url":"https://github.com/mdsteele/rust-icns","last_synced_at":"2025-04-22T17:23:37.602Z","repository":{"id":60775528,"uuid":"58329609","full_name":"mdsteele/rust-icns","owner":"mdsteele","description":"Rust library for encoding/decoding Apple Icon Image (.icns) files","archived":false,"fork":false,"pushed_at":"2024-09-28T12:31:22.000Z","size":740,"stargazers_count":28,"open_issues_count":4,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-22T17:23:27.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdsteele.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2016-05-08T20:18:39.000Z","updated_at":"2025-04-19T03:11:36.000Z","dependencies_parsed_at":"2024-10-19T01:07:34.853Z","dependency_job_id":null,"html_url":"https://github.com/mdsteele/rust-icns","commit_stats":{"total_commits":50,"total_committers":4,"mean_commits":12.5,"dds":0.07999999999999996,"last_synced_commit":"2e95a2eaf2f4475b6a6e68f75725421117707734"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsteele%2Frust-icns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsteele%2Frust-icns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsteele%2Frust-icns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsteele%2Frust-icns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsteele","download_url":"https://codeload.github.com/mdsteele/rust-icns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250285904,"owners_count":21405330,"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-10-01T15:18:46.680Z","updated_at":"2025-04-22T17:23:37.579Z","avatar_url":"https://github.com/mdsteele.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-icns\n\n[![Build Status](https://github.com/mdsteele/rust-icns/actions/workflows/tests.yml/badge.svg)](https://github.com/mdsteele/rust-icns/actions/workflows/tests.yml)\n[![Crates.io](https://img.shields.io/crates/v/icns.svg)](https://crates.io/crates/icns)\n[![Documentation](https://docs.rs/icns/badge.svg)](https://docs.rs/icns)\n\nA Rust library for encoding/decoding Apple Icon Image (.icns) files.\n\n## Overview\n\nThe `icns` crate implements reading and writing of ICNS files, encoding and\ndecoding images into and out of an ICNS icon family, converting those images to\nother pixel formats (in case you need to transfer the image data to another\nlibrary that expects the data in a particular format), and saving/loading those\nimages to/from PNG files.\n\nThe [crate documentation](https://docs.rs/icns) has more information about how\nto use the library.\n\n## Example usage\n\n```rust\nextern crate icns;\nuse icns::{IconFamily, IconType, Image};\nuse std::fs::File;\nuse std::io::{BufReader, BufWriter};\n\nfn main() {\n    // Load an icon family from an ICNS file.\n    let file = BufReader::new(File::open(\"16.icns\").unwrap());\n    let mut icon_family = IconFamily::read(file).unwrap();\n\n    // Extract an icon from the family and save it as a PNG.\n    let image = icon_family.get_icon_with_type(IconType::RGB24_16x16).unwrap();\n    let file = BufWriter::new(File::create(\"16.png\").unwrap());\n    image.write_png(file).unwrap();\n\n    // Read in another icon from a PNG file, and add it to the icon family.\n    let file = BufReader::new(File::open(\"32.png\").unwrap());\n    let image = Image::read_png(file).unwrap();\n    icon_family.add_icon(\u0026image).unwrap();\n\n    // Save the updated icon family to a new ICNS file.\n    let file = BufWriter::new(File::create(\"16-and-32.icns\").unwrap());\n    icon_family.write(file).unwrap();\n}\n```\n\n## Supported icon types\n\nICNS files can contain a number of different icon types.  This library supports\nthe most commonly-used types, but some of the older ones are not yet supported.\nThe table below indicates which types are currently supported; see\nhttps://en.wikipedia.org/wiki/Apple_Icon_Image_format#Icon_types for more\ninformation about each type.\n\nThe biggest limitation at this time is that a number of the newer icon types\ncan be encoded with either PNG or JPEG 2000 data, but this library does not yet\nsupport JPEG 2000; attempting to decode such an icon will result an an error\nvalue being returned (although you can still decode other icons from the same\nICNS file).  The reason for this is that I don't currently know of any JPEG\n2000 libraries for Rust; if one exists, please feel free to file a bug or send\na pull request.\n\n| OSType | Description                             | Supported? |\n|--------|-----------------------------------------|------------|\n| `ICON` | 32×32 1-bit icon                        | No         |\n| `ICN#` | 32×32 1-bit icon with 1-bit mask        | No         |\n| `icm#` | 16×12 1-bit icon with 1-bit mask        | No         |\n| `icm4` | 16×12 4-bit icon                        | No         |\n| `icm8` | 16×12 8-bit icon                        | No         |\n| `ics#` | 16×16 1-bit mask                        | No         |\n| `ics4` | 16×16 4-bit icon                        | No         |\n| `ics8` | 16x16 8-bit icon                        | No         |\n| `is32` | 16×16 24-bit icon                       | Yes        |\n| `s8mk` | 16x16 8-bit mask                        | Yes        |\n| `icl4` | 32×32 4-bit icon                        | No         |\n| `icl8` | 32×32 8-bit icon                        | No         |\n| `il32` | 32x32 24-bit icon                       | Yes        |\n| `l8mk` | 32×32 8-bit mask                        | Yes        |\n| `ich#` | 48×48 1-bit mask                        | No         |\n| `ich4` | 48×48 4-bit icon                        | No         |\n| `ich8` | 48×48 8-bit icon                        | No         |\n| `ih32` | 48×48 24-bit icon                       | Yes        |\n| `h8mk` | 48×48 8-bit mask                        | Yes        |\n| `it32` | 128×128 24-bit icon                     | Yes        |\n| `t8mk` | 128×128 8-bit mask                      | Yes        |\n| `icp4` | 16x16 32-bit PNG/JP2 icon               | PNG only   |\n| `icp5` | 32x32 32-bit PNG/JP2 icon               | PNG only   |\n| `icp6` | 64x64 32-bit PNG/JP2 icon               | PNG only   |\n| `ic07` | 128x128 32-bit PNG/JP2 icon             | PNG only   |\n| `ic08` | 256×256 32-bit PNG/JP2 icon             | PNG only   |\n| `ic09` | 512×512 32-bit PNG/JP2 icon             | PNG only   |\n| `ic10` | 512x512@2x \"retina\" 32-bit PNG/JP2 icon | PNG only   |\n| `ic11` | 16x16@2x \"retina\" 32-bit PNG/JP2 icon   | PNG only   |\n| `ic12` | 32x32@2x \"retina\" 32-bit PNG/JP2 icon   | PNG only   |\n| `ic13` | 128x128@2x \"retina\" 32-bit PNG/JP2 icon | PNG only   |\n| `ic14` | 256x256@2x \"retina\" 32-bit PNG/JP2 icon | PNG only   |\n\n## License\n\nrust-icns is made available under the\n[MIT License](http://spdx.org/licenses/MIT.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsteele%2Frust-icns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsteele%2Frust-icns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsteele%2Frust-icns/lists"}