bin/image_voodoo in image_voodoo-0.2 vs bin/image_voodoo in image_voodoo-0.3
- old
+ new
@@ -25,33 +25,55 @@
opts.separator " --pop --resize 30x30 --dim --preview --save t3.jpg image.jpg"
opts.separator ""
opts.separator "Actions:"
+ opts.on("-a", "--alpha color_value", "Make color transparent in image") do |c|
+ if c !~ /[[:xdigit:]]{6,6}/
+ opts.usage "color_value is rrggbb in hexidecimal format"
+ end
+ actions << lambda {|img| img.alpha(c) }
+ end
+
opts.on("-b", "--brightness SCALE,OFFSET", "Adjust brightness") do |args|
scale, offset = args.split(/\,/i).map {|v| v.to_f}
opts.usage "You need to specify proper scale and offset" unless scale && offset
actions << lambda {|img| img.adjust_brightness(scale, offset) }
end
+ opts.on("-B" "--border WIDTH,COLOR,STYLE", "Add a simple border") do |args|
+ width, color, style = args.split(/\,/i)
+ options = {:width => width, :color => color, :style => style }
+
+ actions << lambda {|img| img.add_border(options) }
+ end
+
opts.on("-d", "--dimensions", "Print the image dimensions") do
actions << lambda {|img| puts "#{img.width}x#{img.height}"; img }
end
opts.on("-g", "--greyscale", "Convert image to greyscale") do
actions << lambda {|img| img.greyscale }
end
+ opts.on("-h", "--flip_horizontally") do
+ actions << lambda {|img| img.flip_horizontally }
+ end
+
opts.on("-n", "--negative", "Make a negative out of the image") do
actions << lambda {|img| img.negative }
end
opts.on("-s", "--save FILENAME", "Save the results to a new file") do |f|
actions << lambda {|img| img.save(f); img }
end
opts.on("-t", "--thumbnail SIZE", Integer, "Create a thumbnail of the given size") do |size|
actions << lambda {|img| img.thumbnail(size) }
+ end
+
+ opts.on("-v", "--flip_vertically") do
+ actions << lambda {|img| img.flip_vertically }
end
opts.on("-p", "--preview", "Preview the image. Close the frame window",
"to continue, or quit the application to", "abort the action pipeline") do
actions << lambda do |img|