diff --git a/lib/fastimage.rb b/lib/fastimage.rb index 3bfceab..d62d858 100644 --- a/lib/fastimage.rb +++ b/lib/fastimage.rb @@ -585,7 +585,7 @@ class FastImage # fields (1) + bg color (1) + pixel ratio (1) fields = @stream.read(3).unpack("CCC")[0] - if fields & 0x80 # Global Color Table + if fields & 0x80 != 0 # Global Color Table # 2 * (depth + 1) colors, each occupying 3 bytes (RGB) @stream.skip(3 * 2 ** ((fields & 0x7) + 1)) end diff --git a/test/fixtures/animated_without_gct.gif b/test/fixtures/animated_without_gct.gif new file mode 100644 index 0000000..acb4c2d Binary files /dev/null and b/test/fixtures/animated_without_gct.gif differ diff --git a/test/test.rb b/test/test.rb index 3d3f9d3..894fda2 100644 --- a/test/test.rb +++ b/test/test.rb @@ -15,6 +15,7 @@ GoodFixtures = { "test_v5header.bmp"=>[:bmp, [40, 27]], "test.gif"=>[:gif, [17, 32]], "animated.gif"=>[:gif, [400, 400]], + "animated_without_gct.gif"=>[:gif, [859, 478]], "test.jpg"=>[:jpeg, [882, 470]], "test.png"=>[:png, [30, 20]], "test2.jpg"=>[:jpeg, [250, 188]], @@ -108,6 +109,7 @@ class FastImageTest < Test::Unit::TestCase assert_equal nil, FastImage.animated?(TestUrl + "test.png") assert_equal false, FastImage.animated?(TestUrl + "test.gif") assert_equal true, FastImage.animated?(TestUrl + "animated.gif") + assert_equal true, FastImage.animated?(TestUrl + "animated_without_gct.gif") end def test_should_return_nil_on_fetch_failure