class ImageParadise::ToGif

Public Class Methods

new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/image_paradise/utility_scripts/to_gif.rb, line 25
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(i)
  run if run_already
end

Public Instance Methods

input?() click to toggle source
#

input?

#
# File lib/image_paradise/utility_scripts/to_gif.rb, line 69
def input?
  @input
end
reset() click to toggle source
#

reset (reset tag)

#
# File lib/image_paradise/utility_scripts/to_gif.rb, line 37
def reset
end
run() click to toggle source
#

run

#
# File lib/image_paradise/utility_scripts/to_gif.rb, line 83
def run # (run tag)
  run_everything
end
run_everything() click to toggle source
#

run_everything

This method contains the main logic of the file.

#
# File lib/image_paradise/utility_scripts/to_gif.rb, line 54
def run_everything
  opn; e 'Next converting '+simp(input?)+' to '+sfile(store_where?)
  _ = 'convert '+input?+' '+store_where?
  esystem _
  if File.exist? store_where?
    opn; e 'We will next try to optimize '+sfile(store_where?)
    opn; e 'The old file size is: '+sfancy(File.size(store_where?).to_s)
    ImageParadise::Optimizer[store_where?]
    opn; e 'The new file size is: '+sfancy(File.size(store_where?).to_s)
  end
end
set_input(i = '') click to toggle source
#

set_input

#
# File lib/image_paradise/utility_scripts/to_gif.rb, line 43
def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup if i
  @input = i
end
store_where?() click to toggle source
#

store_where?

#
# File lib/image_paradise/utility_scripts/to_gif.rb, line 76
def store_where?
  input?.gsub(File.extname(input?),'')+'.gif'
end