class ImageParadise::ImageBorder
Constants
- DELETE_OUTPUT_FILE_IF_IT_EXISTS
#¶ ↑
DELETE_OUTPUT_FILE_IF_IT_EXISTS
¶ ↑#¶ ↑
Public Class Methods
[](i = '')
click to toggle source
Public Instance Methods
assemble_main_command()
click to toggle source
#¶ ↑
assemble_main_command
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/image_border.rb, line 193 def assemble_main_command @cmd = CONVERT+' ' @cmd << input_file?+' ' @cmd << "-bordercolor '#{colour?}' " @cmd << '-border '+@dimension+' ' name_of_the_output_file = determine_name_of_the_output_file @cmd << name_of_the_output_file end
cmd?()
click to toggle source
colour?()
click to toggle source
determine_name_of_the_output_file()
click to toggle source
#¶ ↑
determine_name_of_the_output_file
¶ ↑
Use this method to determine the name of the output file that will be created de-novo.
#¶ ↑
# File lib/image_paradise/utility_scripts/image_border.rb, line 158 def determine_name_of_the_output_file _ = name_of_the_output_file? if File.exist?(_) and !DELETE_OUTPUT_FILE_IF_IT_EXISTS # ===================================================================== # # In this case use a randomized name. # ===================================================================== # sample = '' 20.times { sample << ALPHABET.sample } _ = 'OUTPUT_'+sample+input_file?.sub(/\.png$/,'').sub(/\.jpg$/,'')+'.png' end return _ end
name_of_the_output_file?()
click to toggle source
#¶ ↑
name_of_the_output_file?¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/image_border.rb, line 148 def name_of_the_output_file? 'OUTPUT_'+input_file?.sub(/\.png$/,'').sub(/\.jpg$/,'')+'.png' end
Also aliased as: output_file?
parse_this_input(i)
click to toggle source
#¶ ↑
parse_this_input
¶ ↑
This method will parse the commandline options.
#¶ ↑
# File lib/image_paradise/utility_scripts/image_border.rb, line 104 def parse_this_input(i) if i =~ /(--colour (\S{1,25}))/ set_colour($2.to_s.dup) i.sub!(/#{$1.to_s}/,'') end if i =~ /(--dimension (\S{1,25}))/ set_dimension($2.to_s.dup) i.sub!(/#{$1.to_s}/,'') end return i end
reset()
click to toggle source
run()
click to toggle source
run_main_command()
click to toggle source
set_border_colour(i = 'SkyBlue')
click to toggle source
#¶ ↑
set_border_colour
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/image_border.rb, line 126 def set_border_colour(i = 'SkyBlue') case i.to_s when 'default' i = 'black' when 'RANDOM','random' require 'colours' unless Object.const_defined? :Colours i = Colours.random_html_colour end @border_colour = i end
Also aliased as: set_colour
set_dimension(i)
click to toggle source
set_this_image_file(i = '')
click to toggle source
show_help()
click to toggle source