photile 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/photile +13 -1
  2. data/lib/photile.rb +1 -1
  3. metadata +1 -1
@@ -4,16 +4,28 @@ require 'photile'
4
4
 
5
5
  config = Photile::Cli.parse
6
6
 
7
+ verbose = false
7
8
  config[:options].each do |opt|
8
- opt.each do |key,val|
9
+ opt.each {|key,val| verbose = val if key == :verbose }
10
+ end
11
+
12
+ puts '[photile] Processing...' if verbose
13
+
14
+ config[:options].each_index do |index|
15
+ step = index+1
16
+ config[:options][index].each do |key,val|
9
17
  case key
10
18
  when :quality
19
+ puts "[photile] #{step}. #{config[:infile]} => quality #{val}% => #{config[:outfile]}" if verbose
11
20
  `convert #{config[:infile]} -quality #{val} #{config[:outfile]}`
12
21
  when :compress
22
+ puts "[photile] #{step}. #{config[:infile]} => compress => #{config[:outfile]}" if verbose
13
23
  `jpegtran -copy none -optimize -perfect -outfile #{config[:outfile]} #{config[:outfile]}`
14
24
  when :watermark
25
+ puts "[photile] #{step}. #{config[:infile]} => watermark #{val} => #{config[:outfile]}" if verbose
15
26
  `composite -gravity center #{val} #{config[:infile]} #{config[:outfile]}`
16
27
  when :tile
28
+ puts "[photile] #{step}. #{config[:infile]} => tile #{val[:width]}x#{val[:height]} => [#{config[:outfile]}, ...]" if verbose
17
29
  `convert #{config[:infile]} -crop #{val[:width]}x#{val[:height]} +repage +adjoin #{config[:outfile].split('.').join('%03d.')}`
18
30
  end
19
31
  end
@@ -1,5 +1,5 @@
1
1
  class Photile
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
4
4
 
5
5
  require 'photile/cli'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: