{"id":16361863,"url":"https://github.com/enet4/retroimg","last_synced_at":"2025-03-23T02:31:23.948Z","repository":{"id":40330202,"uuid":"181948451","full_name":"Enet4/retroimg","owner":"Enet4","description":"Convert images to look like in retro IBM hardware","archived":false,"fork":false,"pushed_at":"2023-10-18T19:11:18.000Z","size":1788,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T16:40:45.605Z","etag":null,"topics":["image-manipulation","retrocomputing","rust-lang"],"latest_commit_sha":null,"homepage":"","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/Enet4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2019-04-17T18:36:32.000Z","updated_at":"2025-03-13T22:51:20.000Z","dependencies_parsed_at":"2024-10-28T15:22:22.038Z","dependency_job_id":"6409e134-3b3e-4ace-a797-b2a64b2eb6fa","html_url":"https://github.com/Enet4/retroimg","commit_stats":{"total_commits":42,"total_committers":1,"mean_commits":42.0,"dds":0.0,"last_synced_commit":"eab1990a26c812275b658bb799364e0e980e4410"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enet4%2Fretroimg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enet4%2Fretroimg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enet4%2Fretroimg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enet4%2Fretroimg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Enet4","download_url":"https://codeload.github.com/Enet4/retroimg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245047979,"owners_count":20552430,"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":["image-manipulation","retrocomputing","rust-lang"],"created_at":"2024-10-11T02:15:02.446Z","updated_at":"2025-03-23T02:31:23.938Z","avatar_url":"https://github.com/Enet4.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# retroimg\n\n[![Latest Version](https://img.shields.io/crates/v/retroimg.svg)](https://crates.io/crates/retroimg) [![Continuous integration status](https://github.com/Enet4/retroimg/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Enet4/retroimg/actions/workflows/ci.yml) [![dependency status](https://deps.rs/repo/github/Enet4/retroimg/status.svg)](https://deps.rs/repo/github/Enet4/retroimg)\n\nConvert images to appear to be reproduced on retro IBM hardware.\nIt can also be used to reduce the color depth of existing images\nfor use in DOS game development.\n\n\n| original (640x480, 24-bit RGB) | VGA (320x200, 256 colors, 4:5 pixels) | EGA (320x200, 16 colors, 4:5 pixels) | CGA (320x200, 4 colors + bkg) |\n|--------------------------------|---------------------------------------|--------------------------------------|----------------|\n| ![](samples/pourville.png)     | ![](outputs/pourville-vga.png)        | ![](outputs/pourville-ega.png)       | ![](outputs/pourville-cga.png) |\n| ![](samples/space.png)         | ![](outputs/space-vga.png)            | ![](outputs/space-ega.png)           | ![](outputs/space-cga.png) |\n\nThe full image processing pipeline is composed of the following steps:\n\n1. Image cropping and resizing to a low resolution;\n2. Master palette color quantization and mapping to a restricted color palette, plus color limit with dithering;\n3. Nearest-neighbor resizing to a high resolution, to make pixels look good, also enabling non-square pixels.\n\nEach step can be tweaked or skipped to suit your wishes.\n\n**Note:** This application does not claim to achieve a perfect emulation of old hardware,\nbut it should hopefully attain sufficiently good results for the intended nostalgia kick.\n\n## Using the tool\n\nThe main options are:\n\n- `-s` | `--standard`: the video graphics standard to emulate.\n   This only affects the colors used, not the image resolution.\n   Possible options:\n  - `bw`: 1 bit, black and white\n  - `cga` or `cgamode4`: CGA in mode 4, attempts to choose\n    the best sub-palette and background color\n  - `fullcga`: all 16 colors of the CGA master palette\n  - `cgamode4high1`: CGA in mode 4, always subpalette 1 of high intensity\n    (black, magenta, white, black)\n  - `ega`: all 64 colors from the EGA master palette\n  - `16bit`: 16-bit color depth (4-5-4 RGB)\n  - `vga` (default) or `18bit`: 18-bit master palette\n  - `true` or `24bit`: 24-bit RGB color depth\n- `-R WxH`: the resolution to resize the image into.\n- `-S WxH`: the full image output size, resized from the previous option.\n- `-l L2` or `-l L2`: the color distance/loss algorithm to use for color palette selection\n\nTo convert an image to look like it was presented in VGA mode 13h,\nwith non-square pixels:\n\n```sh\nretroimg «IMAGEFILE» -s vga -R 320x200 -S 1440x1080 -o «out.png»\n```\n\nThis chooses the 256-color palette with the least loss.\nTo use less colors (e.g. 100):\n\n```sh\nretroimg «IMAGEFILE» -s vga -R 320x200 -S 1440x1080 -c 100 -o «out.png»\n```\n\nTo choose an output width or height\nand let the program pick the other dimensions\nbased on pixel ratio:\n\n```sh\nretroimg «IMAGEFILE» -s vga -R 320x200 --height 1080 -r 4:5 -o «out.png»\n```\n\nThis will stretch the image proportionally to the pixel size 4:5,\nmeaning that it works best for images designed for this.\n\nThe full list of options is presented via `retroimg -h` or `retroimg --help`.\n\n## Using the library\n\nThe operations required for doing this\nare available as independent functions.\n\nTo remove dependencies related with the command line application,\nexclude the default feature `cli`.\n\n```toml\n[dependencies.retroimg]\nversion = \"0.3\"\ndefault-features = false\n```\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenet4%2Fretroimg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenet4%2Fretroimg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenet4%2Fretroimg/lists"}