mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-10-06 00:02:01 -04:00
Handle tiff format with long dimension values, fixes #158
This commit is contained in:
parent
a891d8f43a
commit
cad7175e06
@ -30,8 +30,16 @@ module FastImageParsing
|
||||
tag_count = @stream.read(2).unpack(@short)[0]
|
||||
tag_count.downto(1) do
|
||||
type = @stream.read(2).unpack(@short)[0]
|
||||
@stream.read(6)
|
||||
data = @stream.read(2).unpack(@short)[0]
|
||||
data_type = @stream.read(2).unpack(@short)[0]
|
||||
@stream.read(4)
|
||||
|
||||
if data_type == 4
|
||||
data = @stream.read(4).unpack(@long)[0]
|
||||
else
|
||||
data = @stream.read(2).unpack(@short)[0]
|
||||
@stream.read(2)
|
||||
end
|
||||
|
||||
case type
|
||||
when 0x0100 # image width
|
||||
@width = data
|
||||
@ -43,7 +51,6 @@ module FastImageParsing
|
||||
if @width && @height && @orientation
|
||||
return # no need to parse more
|
||||
end
|
||||
@stream.read(2)
|
||||
end
|
||||
end
|
||||
|
||||
|
BIN
test/fixtures/test.dng
vendored
Normal file
BIN
test/fixtures/test.dng
vendored
Normal file
Binary file not shown.
@ -60,6 +60,7 @@ GoodFixtures = {
|
||||
"avif/red_green_flash.avif" => [:avif, [256, 256]],
|
||||
"isobmff.jxl" => [:jxl, [1280,1600]],
|
||||
"naked.jxl" => [:jxl, [1000,1000]],
|
||||
"test.dng" => [:tiff, [4032, 3024]]
|
||||
}
|
||||
|
||||
BadFixtures = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user