Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command line options to disable OptimizeTransLayer/PlusLayer #46

Merged
merged 1 commit into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/screengif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,15 @@ def self.start
canvas = canvas.quantize(256, RGBColorspace, NoDitherMethod)
$stderr.puts "Quantization completed." if $verbose

$stderr.puts "Beginning rmagick OptimizePlusLayer..." if $verbose
canvas = canvas.optimize_layers(OptimizePlusLayer)
$stderr.puts "Beginning rmagick OptimizeTransLayer..." if $verbose
canvas = canvas.optimize_layers(OptimizeTransLayer)
unless options.no_optimize_pluslayer
$stderr.puts "Beginning rmagick OptimizePlusLayer..." if $verbose
canvas = canvas.optimize_layers(OptimizePlusLayer)
end

unless options.no_optimize_translayer
$stderr.puts "Beginning rmagick OptimizeTransLayer..." if $verbose
canvas = canvas.optimize_layers(OptimizeTransLayer)
end

$stderr.puts "Rmagick processing completed. Outputting results..." if $verbose
output = canvas.to_blob
Expand Down
10 changes: 10 additions & 0 deletions lib/screengif/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def self.parse(args)
options.output_file = nil
options.no_gifsicle = false
options.fuzz = 5
options.no_optimize_translayer = false
options.no_optimize_pluslayer = false

# options.ffmpeg_inputfile = nil

Expand Down Expand Up @@ -93,6 +95,14 @@ def self.parse(args)
options.no_gifsicle = true
end

opts.on("--no-optimize-translayer", "Skip Optimize TransLayer.") do
options.no_optimize_translayer = true
end

opts.on("--no-optimize-pluslayer", "Skip Optimize PlusLayer.") do
options.no_optimize_pluslayer = true
end

# Boilerplate
opts.on_tail("-h", "--help", "Show this message") do
puts opts
Expand Down