Git Product home page Git Product logo

tinyjpg's Introduction

Build Status Maintainability

TinyJPG Filesystem watcher and image compress

JPEG image compress watcher based Filesystem event notification github.com/rjeczalik/notify

Example compress quality 82%

original before size 1.47 MB (1,536,181 bytes) compressed after 277.56 KB (284,223 bytes)
screenshot screenshot

Install binary

Installation dependency

~ $ apt install libmagickwand-dev imagemagick

Install TinyJPG for v0.0.9:

curl -L https://raw.githubusercontent.com/OrlovEvgeny/TinyJPG/master/tinyjpg_install.sh | sh -s - v0.0.9

If you prefer Ansible:

tasks:
- name: TinyJPG installed
  sudo: yes
  shell: "curl -L https://raw.githubusercontent.com/OrlovEvgeny/TinyJPG/master/tinyjpg_install.sh | sh -s - v0.0.9"

Edit config File

~ $ vim /etc/tinyjpg/config.yml
##
# TinyJPG v0.0.9
#
# worker - maximum amount workers, Default value - 5
# verbose - verbose log, Default value - true
# worker_buffer - maximum buffer queue workers, Default value - 100
# event_buffer - maximum buffer an event reported by the underlying filesystem notification subsystem, Default value - 100
##
general:
  worker: 5
  worker_buffer: 100
  event_buffer: 300
  verbose: false
  error_log: '/var/log/tinyjpg/error.log'
  info_log: '/var/log/tinyjpg/info.log'

###
# Image compress settings
#
# paths - directories you need to track
# prefix - prefix of files to be processed, Default value all files - *
# example use
#
#   prefix:
#      - 'orig'
#      - 'medium'
#      - 'full'
#
# quality - This param image quality level in percentage.
# If the original image quality is lower than the quality of the parameter - quality
# the image will not be processed
###
compress:
  paths:
    - '/home/www/example.com/uploads'
    - '/home/www/site.org/uploads'
  prefix:
    - '*'
  quality: 82

check that everything is fine

~ $ tinyjpg -help

    Usage of build/tinyjpg:
      -config string
            config file path
      -event_buffer int
            buffer an event reported (default 300)
      -path string
            uploads folder path, default - /home/www (default "/home/www")
      -quality int
            image quality level in percentage (default 82)
      -worker int
            maximum amount workers (default 5)
      -worker_buffer int
            maximum buffer queue workers (default 500)

Use

I recommend using supervisor

example config

~ $ vim /etc/supervisor/conf.d/tinyjpg.conf

write

[program:tinyjpg]
command=/usr/local/bin/tinyjpg -config=/etc/tinyjpg/config.yml
environment=ENVIRONMENT=production
autorestart=true
user=root
redirect_stderr=true
stderr_logfile=/var/log/tinyjpg/log.err.log
stdout_logfile=/var/log/tinyjpg/log.out.log
~ $ mkdir -p /var/log/tinyjpg
~ $ service supervisor restart

or use Tmux

~ $ tinyjpg -config=/etc/tinyjpg/config.yml

deprecated

or use CLI mode

# deprecated
~ $ tinyjpg -path=/home/www/example.com/images -worker=10

Args:

  • path - required. Path to watch new files, default /home/www
  • worker - optional. Amount start workers process, default 5

Build Source

For compilation you need to install Golang1.8

~ $ apt install libmagickwand-dev imagemagick
~ $ git clone https://github.com/OrlovEvgeny/TinyJPG && cd TinyJPG
~ $ go get -u github.com/rjeczalik/notify
~ $ mkdir build && go build -o ./build/tinyjpg *.go
~ $ mv /build/tinyjpg  /usr/local/bin/tinyjpg

permission for execution

~ $ chmod +x /usr/local/bin/tinyjpg

License:

MIT

tinyjpg's People

Contributors

gitter-badger avatar ixqbar avatar orlovevgeny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tinyjpg's Issues

Color shift on example images

There is a quite noticable color shift in your example images. The tones go from warmer (orange) to pale (green).

for bug

for i := 0; i > settings.General.Worker; i++ {
		go im.process(c)
	}
for i := 0; i < settings.General.Worker; i++ {
		go im.process(c)
	}

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.