gif2c now throws an exception if the gif file contains frames with differing sizes.

This commit is contained in:
Fabian Schlenz 2019-06-04 05:59:00 +02:00
parent f95589763e
commit 1d693f34e9
1 changed files with 5 additions and 0 deletions

View File

@ -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)