lib/zpng/cli.rb in zpng-0.2.3 vs lib/zpng/cli.rb in zpng-0.2.4
- old
+ new
@@ -54,10 +54,14 @@
opts.separator ""
opts.on "-A", '--ascii', 'Try to convert image to ASCII (works best with monochrome images)' do
@actions << :ascii
end
+ opts.on '--ascii-string STRING', 'Use specific string to map pixels to ASCII characters' do |x|
+ @options[:ascii_string] = x
+ @actions << :ascii
+ end
opts.on "-N", '--ansi', 'Try to display image as ANSI colored text' do
@actions << :ansi
end
opts.on "-2", '--256', 'Try to display image as 256-colored text' do
@actions << :ansi256
@@ -214,10 +218,10 @@
end
def ascii
@img.height.times do |y|
@img.width.times do |x|
- c = @img[x,y].to_ascii
+ c = @img[x,y].to_ascii *[@options[:ascii_string]].compact
c *= 2 if @options[:wide]
print c
end
puts
end