Skip to main content
This guide shows how to install a GitHub App into a repository to automate image optimization. The example uses the gh-as schedules repository (containing many images) and the Imgbot GitHub App to create automated pull requests that replace large images with optimized versions. Here’s an example image from the repository so you can see what we’ll be optimizing.
A GitHub repository page in dark mode showing a file tree with an images folder and "background.gif" selected. The preview shows a black, starry space background with small colored stars.
Why automate image optimization?
  • Saves manual effort when the repo contains many images.
  • Reduces repository size and bandwidth usage.
  • Keeps original image quality while improving storage and performance.
  • Produces an auditable pull request so maintainers can review changes.
Quick comparison: manual vs automated image optimization Find apps on the GitHub Marketplace (github.com/marketplace). For this walkthrough we’ll use Imgbot — see its Marketplace listing for details, verification status, and install options.
A dark-themed screenshot of the GitHub Marketplace page for "Imgbot," showing the app's README content on the left and an About panel on the right with install count, verification badge, tags, and a "Set up a free trial" button. The README explains that Imgbot optimizes images and why you should use it.
Open-source/public repository plans for many Marketplace apps are often free and allow unlimited public repositories. If you need the app to run on private repositories, a paid tier is commonly required—choose the plan that matches your privacy and billing requirements.
Installation overview — what to expect
  1. From the Marketplace listing click Install (or Set up a free trial) and choose the target account (user or organization).
  2. Select the repositories the app should access: either all repositories or specific repositories. For least privilege, choose only the repositories the app needs.
  3. Review requested permissions. Typical permissions for an image-optimizing app:
    • Read repository metadata
    • Read and write repository contents (to update images)
    • Create pull requests
  4. Confirm the billing/plan option if you are installing to private repositories.
In this demo I install Imgbot into the organization game-devstudio and restrict it to a single repository (ghas-guardrail-demo). The installation page shows repository selection and the permissions the app requires.
A screenshot of a GitHub app installation page asking to install an app on the organization "game-devstudio." It shows the "Only select repositories" option with one repo selected (ghas-guardrail-demo), listed permissions, and Install/Cancel buttons.
Security and governance tips
  • Grant the minimum necessary repository access. Use “Only select repositories” when available.
  • Review the app’s permissions and documentation on the Marketplace page.
  • Manage installed apps from your organization settings under “Installed GitHub Apps” or “Applications” to suspend or uninstall if needed.
After installation, the app scans the selected repository. If it is configured to optimize images automatically, it will generate a pull request with optimized files. Allow a few minutes for the scan and PR creation. When Imgbot opens a pull request it includes a clear summary: each optimized image, the original file size, the new file size, and the percent reduction. The PR also reports the overall repository savings so maintainers can quickly assess impact before merging.
A dark‑mode GitHub pull request page titled "[ImgBot] Optimize images #8." The imgbot comment displays a table showing image filenames with their before/after file sizes and percent size reductions.
Step-by-step checklist for using Imgbot (or similar GitHub Apps)
  • Locate and review the app on the GitHub Marketplace: https://github.com/marketplace/imgbot
  • Click Install and choose the account and repository scope.
  • Verify requested permissions and select an appropriate plan for private repositories.
  • Install and wait for the app to scan and submit a pull request.
  • Review the PR changes: file diffs, before/after sizes, and the app’s summary.
  • If everything looks good, merge the PR; if not, request changes or adjust app configuration.
References and further reading Using a GitHub App like Imgbot is a simple, scalable way to reduce image size across many files while preserving quality and keeping maintainers in control through pull request reviews.

Watch Video