{"id":26278515,"url":"https://github.com/open-technology-foundation/c2i","last_synced_at":"2026-05-08T13:20:18.550Z","repository":{"id":282376756,"uuid":"948252034","full_name":"Open-Technology-Foundation/c2i","owner":"Open-Technology-Foundation","description":"A lightweight utility for saving clipboard PNG images to files with timestamp.","archived":false,"fork":false,"pushed_at":"2025-03-14T08:46:32.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T12:05:57.215Z","etag":null,"topics":["bash-script","clipboard","images","linux"],"latest_commit_sha":null,"homepage":"https://yatti.id/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Open-Technology-Foundation.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":"2025-03-14T02:11:31.000Z","updated_at":"2025-03-14T08:46:35.000Z","dependencies_parsed_at":"2025-03-14T09:35:35.151Z","dependency_job_id":"f57e74bf-27dc-43c3-9ff1-d2dd29312e15","html_url":"https://github.com/Open-Technology-Foundation/c2i","commit_stats":null,"previous_names":["open-technology-foundation/c2i"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fc2i","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fc2i/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fc2i/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fc2i/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-Technology-Foundation","download_url":"https://codeload.github.com/Open-Technology-Foundation/c2i/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fc2i/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259102924,"owners_count":22805592,"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":["bash-script","clipboard","images","linux"],"created_at":"2025-03-14T13:16:12.469Z","updated_at":"2026-05-08T13:20:18.545Z","avatar_url":"https://github.com/Open-Technology-Foundation.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clipboard to Image (c2i)\n\nA lightweight, robust utility for saving PNG images from clipboard to timestamped files.\n\n```bash\ngit clone https://github.com/Open-Technology-Foundation/c2i.git \u0026\u0026 cd c2i \u0026\u0026 sudo make install\n```\n\n## Version 1.2.0\n\n### What's New in v1.2.0\n- **Simplified Message System**: Replaced text-based status prefixes with icons (◉, ✓, ✗)\n- **Cleaner Variable Declarations**: Switched to `declare -r` for constants\n- **Improved Option Bundling**: Rewritten combined short option handling\n- **Better Error Formatting**: Error messages use `${var@Q}` for quoted output\n\n## Features\n\n- Save PNG images from clipboard with automatic timestamps\n- Optional image compression using pngquant (20-100 quality range)\n- Configurable output directory (defaults to `/tmp`)\n- Copy saved file path to clipboard for easy sharing (`-p` flag)\n- Quiet mode for scripting (`-q` flag)\n- Verbose mode for detailed output (`-v` flag)\n- Simple, focused command-line interface\n\n## Installation\n\n### Dependencies\n\n**Required:**\n- `xclip` - Clipboard access\n\n**Optional:**\n- `pngquant` - Image compression (only needed with `-c` flag)\n\n#### Install on Debian/Ubuntu:\n```bash\nsudo apt update \u0026\u0026 sudo apt install xclip pngquant\n```\n\n### Setup\n\n```bash\ngit clone https://github.com/Open-Technology-Foundation/c2i.git\ncd c2i\nsudo make install\n```\n\nThis installs the script, symlink, manpage, and bash completion to `/usr/local`.\nTo customise the prefix: `sudo make PREFIX=/opt/local install`\n\n## Usage\n\n```\nc2i [OPTIONS] [output_dir]\n```\n\n### Options\n\n| Option | Description |\n|--------|-------------|\n| `-c, --compress [INT]` | Compress image using pngquant. INT range: 20-100 (lower = higher compression). Default: 50 |\n| `-p, --copy-path` | Copy the saved file path to clipboard (replaces image) |\n| `-v, --verbose` | Verbose output (default) |\n| `-q, --quiet` | Suppress output |\n| `-V, --version` | Show version |\n| `-h, --help` | Display help |\n\n### Examples\n\n```bash\n# Take a screenshot with your system tool, then:\n\n# Save to /tmp (default)\nc2i\n# Output: /tmp/image-20250316-143022.png\n\n# Save to current directory\nc2i .\n\n# Save to specific folder with compression\nc2i -c ~/Pictures\n# Compresses with default quality (50)\n\n# Save with high compression (quality 30)\nc2i -c 30 ~/Pictures\n\n# Save and copy path to clipboard for sharing\nc2i -p ~/Documents\n# The file path replaces the image in clipboard\n\n# Capture filepath in a variable (verbose mode outputs to stdout)\nimgpath=$(c2i ~/Pictures)\necho \"Saved to: $imgpath\"\n\n# Combine options\nc2i -pc 70 ~/Pictures\n# Compress at quality 70 and copy path to clipboard\n```\n\n## Output Format\n\nFiles are saved with the pattern:\n```\n{output_dir}/image-{YYYYMMDD-HHMMSS}.png\n```\n\nExample: `image-20250316-143022.png`\n\nThis timestamp format ensures:\n- Files sort chronologically\n- No naming conflicts\n- Easy identification of when the image was captured\n\n## Testing\n\nThe project includes a comprehensive test suite.\nCopy a screen region to the clipboard before running tests.\n\n```bash\n# Run all tests\nmake test\n\n# Create test fixture from clipboard image\nmake -C tests test-fixtures\n\n# Run specific test file\nbash tests/test-basic-functionality.sh\n```\n\nTest coverage includes:\n- Basic functionality (save, quiet, verbose modes)\n- Compression with various quality levels\n- Clipboard path copying\n- Error handling and edge cases\n- Argument parsing\n- File naming and timestamps\n\n## Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| 0 | Success |\n| 1 | General error (no image, directory issues, etc.) |\n| 2 | Too many arguments |\n| 22 | Invalid command-line option |\n\n## Project Structure\n\n```\nc2i/\n├── clipboard-to-imagefile    # Main script\n├── c2i                       # Symlink to main script\n├── Makefile                  # Install/uninstall/test targets\n├── c2i.1                     # Man page\n├── c2i.bash_completion       # Tab completion support\n├── README.md                 # This file\n├── LICENSE                   # GPL-3 License\n└── tests/                    # Test suite\n    ├── run-tests.sh          # Test runner\n    ├── test-*.sh             # Individual test files\n    ├── fixtures/             # Test images\n    └── Makefile              # Test automation\n```\n\n## Code Quality\n\nThis project follows strict Bash coding standards:\n- `set -euo pipefail` for safety\n- Proper variable scoping with `local` and `declare`\n- Consistent error handling with meaningful exit codes\n- Shellcheck validated (no warnings)\n- Comprehensive input validation\n- Clear separation of stdout/stderr output\n\n## Contributing\n\nContributions are welcome! Please ensure:\n1. All tests pass: `make test`\n2. Shellcheck reports no issues: `shellcheck -x clipboard-to-imagefile`\n3. New features include corresponding tests\n\n## License\n\nGPL-3\n\n## Troubleshooting\n\n**No image in clipboard:**\n- Ensure you've copied a PNG image (screenshots work)\n- Some applications may not copy images in PNG format\n\n**Permission denied:**\n- Check output directory permissions\n- Ensure the script is executable: `chmod +x clipboard-to-imagefile`\n\n**xclip not found:**\n- Install with: `sudo apt install xclip`\n- Required for clipboard access\n\n**Compression not working:**\n- Install pngquant: `sudo apt install pngquant`\n- Only needed when using `-c` flag\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Fc2i","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-technology-foundation%2Fc2i","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Fc2i/lists"}