mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-09-20 00:01:59 -04:00
Merge pull request #122 from nbianca/fix_gif
Fix GIF global color table flag check
This commit is contained in:
commit
ddf9f25cef
@ -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
|
||||
|
BIN
test/fixtures/animated_without_gct.gif
vendored
Normal file
BIN
test/fixtures/animated_without_gct.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user