Coder Social home page Coder Social logo

tanbinh123 / tinifier Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tarampampam/tinifier

0.0 0.0 0.0 41.62 MB

๐Ÿผ CLI client for images compressing using tinypng.com API

Home Page: https://tinypng.com/third-party

License: MIT License

Go 96.08% Makefile 2.37% Dockerfile 1.55%

tinifier's Introduction

Logo

CLI tool for images compressing

Release version Build Status Coverage Image size License

This tool uses tinypng.com API endpoint for compressing your local jpg/png images (it supports parallel jobs):

API key can be set using environment variable named TINYPNG_API_KEY

Installing

Download latest binary file for your os/arch from releases page or use our docker image (ghcr.io).

Go package

Project language Go Reference Go Report

Install the API client with go get:

$ go get -u github.com/tarampampam/tinifier/v3

Client sources and usage examples can be found in pkg/tinypng directory.

Usage example

tinypng.com API key is required. For API key getting you should:

  • Open tinypng.com/developers
  • Fill-up the form (enter your name and email address) and press "Get your API key" button
  • Check for email in the mailbox from previous step (click on "verification link")
  • In opened dashboard page - activate API key and save it somewhere

Compress single image:

$ tinifier compress -k 'YOUR-API-KEY-GOES-HERE' ./img.png

Compress all png images in some directory and 2 another images:

$ tinifier compress -k 'YOUR-API-KEY-GOES-HERE' -e png ./images-directory ./img-1.png ./img-2.png

Compress jpg/png images in some directory (recursively) using 20 threads:

$ tinifier compress -k 'YOUR-API-KEY-GOES-HERE' -e png -e jpg -e PNG -e JPG -t 20 -r ./some-dir

Using docker

image stats

All supported image tags can be found here and here.

Compress all images in current directory:

$ docker run --rm -ti \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/rootfs:rw" \
    -w /rootfs \
    tarampampam/tinifier compress -k 'YOUR-API-KEY-GOES-HERE' -r .

or

$ docker run --rm -ti \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/rootfs:rw" \
    -w /rootfs \
    -e 'TINYPNG_API_KEY=YOUR-API-KEY-GOES-HERE' \
    tarampampam/tinifier compress -r .

Testing

For application testing and building we use built-in golang testing feature and docker-ce + docker-compose as develop environment. So, just write into your terminal after repository cloning:

$ make test

Or build the binary file:

$ make build

Releasing

New versions publishing is very simple - just make required changes in this repository, update changelog file and "publish" new release using repo releases page.

Binary files and docker images will be build and published automatically.

New release will overwrite the latest docker image tag in both registers.

Changelog

Release date Commits since latest release

Changes log can be found here.

Support

Issues Issues

If you will find any package errors, please, make an issue in current repository.

License

This is open-sourced software licensed under the MIT License.

tinifier's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar jetexe avatar renovate[bot] avatar tarampampam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.