github-action-image-resizer

📰 GitHub action for images resizing

GPL-3.0 License

Stars
2
Committers
3

Image Resizer

GitHub Action to resize images (jpeg, png, webp, avif, tiff, gif, svg) from file/url

Table of contents

Description

Provides operations on resizing input images from a file or url (jpeg, png, webp, avif, tiff, gif, svg) by format parameters.

Inputs

sourceData

Optional JSON data source file with action parameters:

Complete parameters

[
    {
        "width": 150,
        "height": 250,
        "quality": 100,
        "formatType": "jpeg",
        "sourceFile": "./data/input.jpg",
        "targetPath": "./data",
        "targetFile": "output.jpg"
    },
    {
        "width": 250,
        "height": 250,
        "formatType": "png",
        "sourceFile": "./data/input2.png",
        "targetPath": "./data",
        "targetFile": "output2.png"
    },
    {
        "width": 350,
        "height": 350,
        "formatType": "jpeg",
        "sourceFile": "https://lunrjs.com/images/moon.jpg",
        "targetPath": "./data"
    }
]

Basic parameters

[
    {
        "width": 150,
        "height": 250,
        "formatType": "jpeg",
        "sourceFile": "./data/input.jpg",
        "targetPath": "./data"
    },
    {
        "width": 250,
        "height": 250,
        "formatType": "png",
        "sourceFile": "./data/input2.png",
        "targetPath": "./data"
    },
    {
        "width": 350,
        "height": 350,
        "formatType": "jpeg",
        "sourceFile": "https://lunrjs.com/images/moon.jpg",
        "targetPath": "./data"
    }
]

width

Required Target image width

height

Required Target image height

quality

Optional Target image quality (should be in range 0-100)

formatType

Required Target image format type (any from the list: heic, heif, avif, jpeg, png, raw, tiff, webp, gif)

sourceFile

Required Source input image file or url to fetch content from

targetPath

Required Target path to store processed image files

targetFile

Optional Target image file name (default sourceFile)

Outputs

changed

Image file processing operation status

true

When input image file successfully processed

false

When error occurred while processing input image file

Examples

- name: Resize images
  uses: alexrogalskiy/github-action-image-resizer@master
  with:
    prefix: '<!--views:marker:start-->\n'
    suffix: '\n<!--views:marker:end-->'
    sourceFile: './data/info.md'
    placeholder: '<!--views:marker:start-->[\s\S]*?<!--views:marker:end-->'
    replacement: '<p align="center" style="text-align:center;">Data Block</p>'

Running locally:

  • npm run start:action --action github-action-image-resizer --prefix '<!--views:marker:start-->\n' --suffix '\n<!--views:marker:end-->' --sourceFile './data/info.md' --placeHolder '<!--views:marker:start-->[\s\S]*?<!--views:marker:end-->' --replacement '<p align="center" style="text-align:center;">Data Block</p>'

Visitor stats

Licensing

Image Resizer is distributed under LGPL version 3 or later, [License]. LGPLv3 is additional permissions on top of GPLv3.

Authors

Image Resizer is maintained by the following GitHub team-members:

  • Author

with community support please contact with us if you have some question or proposition.

Versioning

The project uses SemVer for versioning. For the versions available, see the tags on this repository.

Contribution

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us (emoji key).

This project follows the all-contributors specification. Contributions of any kind are welcome!

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

Acknowledgement

Forks

Development Support

Like Image Resizer ? Consider buying me a coffee :)