mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-09-20 00:01:59 -04:00
Merge pull request #109 from abcang/supports_various_bitmap_headers
Supports various bitmap headers
This commit is contained in:
commit
a86e02db9c
@ -580,10 +580,10 @@ class FastImage
|
||||
d = @stream.read(32)[14..28]
|
||||
header = d.unpack("C")[0]
|
||||
|
||||
result = if header == 40
|
||||
d[4..-1].unpack('l<l<')
|
||||
else
|
||||
result = if header == 12
|
||||
d[4..8].unpack('SS')
|
||||
else
|
||||
d[4..-1].unpack('l<l<')
|
||||
end
|
||||
|
||||
# ImageHeight is expressed in pixels. The absolute value is necessary because ImageHeight can be negative
|
||||
|
BIN
test/fixtures/test_coreheader.bmp
vendored
Normal file
BIN
test/fixtures/test_coreheader.bmp
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
test/fixtures/test_v5header.bmp
vendored
Normal file
BIN
test/fixtures/test_v5header.bmp
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
@ -11,6 +11,8 @@ FixturePath = File.join(PathHere, "fixtures")
|
||||
GoodFixtures = {
|
||||
"test.bmp"=>[:bmp, [40, 27]],
|
||||
"test2.bmp"=>[:bmp, [1920, 1080]],
|
||||
"test_coreheader.bmp"=>[:bmp, [40, 27]],
|
||||
"test_v5header.bmp"=>[:bmp, [40, 27]],
|
||||
"test.gif"=>[:gif, [17, 32]],
|
||||
"test.jpg"=>[:jpeg, [882, 470]],
|
||||
"test.png"=>[:png, [30, 20]],
|
||||
|
Loading…
x
Reference in New Issue
Block a user