{"id":25849563,"url":"https://github.com/fjcaetano/xcode-png-optim","last_synced_at":"2025-10-09T21:10:43.538Z","repository":{"id":146858930,"uuid":"434756646","full_name":"fjcaetano/xcode-png-optim","owner":"fjcaetano","description":"🏞 Scans an Xcode target for PNGs and converts all to optimized JPEGs","archived":false,"fork":false,"pushed_at":"2021-12-07T18:10:58.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-01T11:33:39.561Z","etag":null,"topics":["automation","build-phase","build-script","image","jpeg","optimization","png","xcode"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/fjcaetano.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-12-03T23:05:16.000Z","updated_at":"2025-01-28T18:10:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"6921fb09-2ecd-4034-917f-92ee09b66642","html_url":"https://github.com/fjcaetano/xcode-png-optim","commit_stats":{"total_commits":5,"total_committers":2,"mean_commits":2.5,"dds":0.4,"last_synced_commit":"b638eb964510cf25c344a0ddc8b153e6e6e6eb5b"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fjcaetano/xcode-png-optim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjcaetano%2Fxcode-png-optim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjcaetano%2Fxcode-png-optim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjcaetano%2Fxcode-png-optim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjcaetano%2Fxcode-png-optim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fjcaetano","download_url":"https://codeload.github.com/fjcaetano/xcode-png-optim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjcaetano%2Fxcode-png-optim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002074,"owners_count":26083285,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["automation","build-phase","build-script","image","jpeg","optimization","png","xcode"],"created_at":"2025-03-01T11:28:56.308Z","updated_at":"2025-10-09T21:10:43.523Z","avatar_url":"https://github.com/fjcaetano.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"🏞  xcode-png-optim ![homebrew][1] [![PRs welcome][2]](https://github.com/fjcaetano/xcode-png-optim/pulls)\n---\n\nScans an Xcode target for PNGs and converts all to optimized JPEGs. If an image's directory contains a `Contents.json` file, `xcode-png-optim` understands it's within an `Assets.xcassets` catalog and will update the JSON file accordingly.\n\nBy default, `xcode-png-optim` will convert only non-transparent PNGs. If you need to tweak the tolerance level for the alpha channel of each image, use the `--alpha-tolerance` argument. The tolerance must be a value between zero and one, where 0 is no tolerance (e.g. if an image has any transparency at all, it will be ignored) and 1 is full tolerance (e.g. all PNGs will be converted, regardless of transparency levels).\n\n## Installation \n\nAssuming that you have [Homebrew](https://brew.sh/) installed, execute the following steps:\n\n1. Use this repository as a \"tap\" (alternative package repository):\n\n```sh\n$ brew tap fjcaetano/xcode-png-optim\n```\n\n2. Install xcode-png-optim (and dependencies):\n\n```sh\n$ brew install xcode-png-optim\n```\n\n### Automatically converting using a build script (optional)\n\nIf you want Xcode to automatically convert PNGs added to assets catalogs, add the following Build Script to the desired target **before the `Copy Bundle Resources`** phase.\n\n```sh\nif which xcode-png-optim \u003e/dev/null; then\n  xcode-png-optim \"$SOURCE_ROOT/$TARGET_NAME\"\nelse\n  echo \"error: xcode-png-optim not installed, download from https://github.com/fjcaetano/xcode-png-optim\"\n  exit 1\nfi\n```\n\u003e Notice that the script above will fail the build process if `xcode-png-optim` is not installed. If that's not desirable, remove the `exit 1` line and change the message from `error: ...` to `warning: ...`\n\n## Usage\n\n```sh\n$ xcode-png-optim [options] {dir_name}\n```\n\n| Options                  | Description                       | Default value |\n| ------------------------ | --------------------------------- | :-----------: |\n| -t, --alpha-tolerance    | The tolerance allowed for the alpha channel. Value must be 0...1 | `0` |\n| -x, --no-xcode-log       | Do not format output for Xcode. When this is set, the output will include ANSI colors | N/A |\n| -c, --no-update-contents | Do not update Content.json files  |      N/A      |\n| -i, --ignore-cache       | Ignores the cached files          |      N/A      |\n| -f, --force              | Forces the convertion, overwriting existing files | N/A |\n| -h, --help               | Prints helper message             |      N/A      |\n| -v, --version            | Prints current version            |      N/A      |\n\nIf no `dir_name` is given, the optimization will use the current directory.\n\n[1]: https://img.shields.io/github/tag/fjcaetano/xcode-png-optim?color=orange\u0026label=homebrew\n[2]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjcaetano%2Fxcode-png-optim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffjcaetano%2Fxcode-png-optim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjcaetano%2Fxcode-png-optim/lists"}