From 1d693f34e94ce9508f427cb072d07c7b95a3d980 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Tue, 4 Jun 2019 05:59:00 +0200 Subject: [PATCH] gif2c now throws an exception if the gif file contains frames with differing sizes. --- src/tools/gif2c.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/gif2c.rb b/src/tools/gif2c.rb index e30f119..7f5677a 100755 --- a/src/tools/gif2c.rb +++ b/src/tools/gif2c.rb @@ -70,9 +70,14 @@ if times.uniq.count==1 times = times[0, 1] end +total_x, total_y = frames.first.columns, frames.first.rows + STDERR.print "Getting colors..." colors = [] frames.each do |frame| + if frame.columns!=total_x || frame.rows!=total_y + raise "The gif file has frames with different sizes. Such gifs are not supported at the moment, sorry." + end frame.columns.times do |x| frame.rows.times do |y| color = frame.pixel_color(x, y).to_color(Magick::AllCompliance, true, 8, true)[1,8].to_i(16)