{"id":13591363,"url":"https://github.com/ern0/shrinkshot","last_synced_at":"2025-04-01T10:58:20.827Z","repository":{"id":72784531,"uuid":"64997675","full_name":"ern0/shrinkshot","owner":"ern0","description":"✂ CLI tool for shrink images by removing empty regions (best use case: screenshot)","archived":false,"fork":false,"pushed_at":"2019-11-18T07:50:30.000Z","size":1728,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-06T11:46:19.667Z","etag":null,"topics":["concept","image-processing","imagemagick","screenshot"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ern0.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}},"created_at":"2016-08-05T07:16:05.000Z","updated_at":"2023-04-12T20:47:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"7faaf6de-ca83-441b-a657-1f6b971ec89b","html_url":"https://github.com/ern0/shrinkshot","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ern0%2Fshrinkshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ern0%2Fshrinkshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ern0%2Fshrinkshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ern0%2Fshrinkshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ern0","download_url":"https://codeload.github.com/ern0/shrinkshot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246628239,"owners_count":20808106,"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":["concept","image-processing","imagemagick","screenshot"],"created_at":"2024-08-01T16:00:56.660Z","updated_at":"2025-04-01T10:58:20.809Z","avatar_url":"https://github.com/ern0.png","language":"C++","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# ShrinkShot\n\nA simple CLI tool to detect and cut out empty areas of an image (screenshot) in order to make it smaller without resizing its content.\n\n## Features\n\nThe program simply scans for whole pixel columns and lines which are identical to their neigbours. These columns and lines can be cut out from the image, no information will be loss, but the image will be smaller and more compact.\n\nThe program itself only a CLI tool, which tries to detect empty areas in a specified PNG image, then calls - with a bunch of parameters - ImageMagick's `convert` utility, which is doing the actual job.\n\nYou may assign a hotkey to yout script, which makes a screenshot of a window, passing through it on shrinkshot, and saves it.\n\n## Installation\n\nTo make it work, first, you should install ImageMagick:\n\n- MacOS: `brew install imagemagick`\n- Debian/Ubuntu Linux: `sudo apt-get install imagemagick`\n- etc.\n\nAlso, don't forget to checkout the `upng` GIT submodule:\n`git submodule update --init --recursive`\n\n## Usage\n\n```\n$ shrinkshot screenshot.png result.png\n```\n\nTo make it work, first, you should install ImageMagick:\n\n- MacOS: `brew install imagemagick`\n- Debian/Ubuntu Linux: `sudo apt install imagemagick`\n- Windows: `choco install imagemagick`\n\nThen you may pass the parameters to `convert` utility\u003e\n\nIf any problem occurs, `shrinkshot` prints error messages to `stderr`.\n\n## Build\n\n### For Unix systems\n\nJust start `compile.sh`. Requires GCC to be installed.\n\n### For Windows\n\nYou can build Windows executable on both Windows and Unix systems\n(not tested on Linux). All you have to do is install MinGW and\nlaunch `compile-for-windows.sh` on Unix systems or `compile-on-windows.bat`\non Windows.\n\nAlso, you may use the executable provided in `bin/` directory.\n\n## TODO\n\n### Needs more test\n\n- Only tested on sample images you can found in the `test/` directory\n(converted images are also included).\n- Not tested on Linux distros yet.\n\n### Known issues to be fixed\n\n- If you make a screenshot by marking the cut region by hand (sometimes called snipping tool), empty area detection may fail on the background image. A simple solution is just simply ignore 3-4 pixels on the borders, this hack will be applied soon.\n- Noisy regions are not detected.\n\n### Algorithm enhancements\n\nIt would be great to split the image to more regions\n(e.g. horizontal stripes), and cut out (same width) areas from it\nat different (horizontal) positions.\n\nThe most known use case of it is the status bar, which should be\ncut separately:\n\nThis image has no columns to cut (only lines):\n````\n  ---------------------------\n | content           content |\n | on left           on the  |\n |                right side |\n |                           |\n |                           |\n |          status           |\n  ---------------------------\n````\n\nBut it should be:\n````\n  ----------------------\n | content     content |\n | on left     on the  |\n |          right side |\n |                     |\n |                     |\n |       status        |\n  ---------------------\n````\n\nThe \"status\" line occupies small vertical size,\nso it's a good candidate to handle differently from the main area.\n\nEmpty areas marked with numbers (vertical only):\n````\n  ---------------------------   --\n | content 111111    content |  |\n | on left 111111    on the  |  | large area\n |         111111 right side |  |\n |         111111            |  |\n |         111111            |  --\n | 22222222 status 222222222 |  | small area\n  ---------------------------   --\n````\n\nThe program should detect main area (primary target for shrinking),\nand try to shrink same amout from smaller areas.\n\n### Enhance distribution\n\nShrinkShot is now a CLI tool for. It should be turned to an easy-to-install solution for making shrinked screenshots with a hotkey.\n\nI don't want to turn it to a boxed software with printed manual, but the distribution should be more user-friendly:\n- Linux: provide a shell script, which can be assigned to a hotkey. Probably release it as a `.deb` package.\n- MacOS: have no idea.\n- Windows: have no idea.\n\n## Credits\n\nThe idea and some sample images come from a question issued by *@Thomas* on the Software Recommendation (StackExchange) site.\n\nThe actual conversation is done by **ImageMagick**.\n\nShrinkShot is using **UPNG** library to load and parse PNG files. It's included in the repository as a GIT submodule.\n\n## Copyright\n\nUse it as you want. I'll be happy if you integrate it and mention it in the credits.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fern0%2Fshrinkshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fern0%2Fshrinkshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fern0%2Fshrinkshot/lists"}