Skip to content

MarketingPipeline/Image-Optimizer-Action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image-Optimizer-Action

A Github Action to optimize to optimize / compress images
Show your support!

Example and usage

View Example Of Image Compression Results
     ✅  [OPTIMIZED] ./image_1.png                                                   
         PNG/RGBA: 516.6 KB  ->  PNG/RGBA: 490.8 KB 🔻 5.0%
     ✅  [OPTIMIZED] ./image_2.png                                               
         PNG/RGBA: 771.8 KB  ->  PNG/RGBA: 741.5 KB 🔻 3.9%
     ✅  [OPTIMIZED] ./image_3.png                                                    
         PNG/RGBA: 737.3 KB  ->  PNG/RGBA: 707.8 KB 🔻 4.0%
     ✅  [OPTIMIZED] ./image_4.png                                                    
         PNG/RGBA: 31.4 KB  ->  PNG/RGBA: 30.7 KB 🔻 2.3%
     ✅  [OPTIMIZED] ./image_5.png                                        
         PNG/RGBA: 203.9 KB  ->  PNG/RGBA: 200.0 KB 🔻 1.9%
     ✅  [OPTIMIZED] ./image_6.png                                          
         PNG/RGBA: 534.2 KB  ->  PNG/RGBA: 514.5 KB 🔻 3.7%
         ----------------------------------------
         Processed 6 files (2.7 MB) in 4.3s (1.4 f/s).
         Optimized 6 files.
         Average savings: 18.3 KB per optimized file
         Total space saved: 109.9 KB / 3.9%
How to use this action

Note: By DEFAULT all supported image file types in the root of your repo excluding sub-folders will be optimized. (SVG images are NOT supported)


To optimize a single image file:
   - uses: MarketingPipeline/Image-Optimizer-Action@main
     with:
       filename: filename.jpg



To optimize all image files in a directory and all of its subdirectories:
   - uses: MarketingPipeline/Image-Optimizer-Action@main
     with:
       filename: /example_folder_path/
       recursion: true



To optimize all image files in a directory, without recursion:
   - uses: MarketingPipeline/Image-Optimizer-Action@main
     with:
       filename: /example_folder_path/



Workflow Example(s)



View Example Workflow Usage

- uses: actions/checkout@v2
- uses: MarketingPipeline/Image-Optimizer-Action@main

- name: Commit and Push Optimized Images
  run: |
     git config --global user.name "github-actions[bot]"
     git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
     git add -A
     git commit -m "Added Optimized Images"
     git push

Example workflow file



Contributing GitHub

Want to imrpove this action? Create a pull request with described in detail with your changes! If approved you will be added to the list of contributors of this awesome project!

See also the list of contributors who participate in this project.

License GitHub

This project is licensed under the MIT License - see the LICENSE.md file for details.