photile 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/photile +13 -1
- data/lib/photile.rb +1 -1
- metadata +1 -1
data/bin/photile
CHANGED
@@ -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
|
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
|
data/lib/photile.rb
CHANGED