1
0
mirror of https://github.com/fumiama/imgsz.git synced 2026-06-21 03:11:25 +08:00

feat: support bmp & tiff format

This commit is contained in:
源文雨
2024-05-06 18:09:27 +09:00
parent 7dbe326aaa
commit f7e2ba842a
8 changed files with 554 additions and 0 deletions

View File

@@ -57,4 +57,30 @@ func TestSizes(t *testing.T) {
t.Fatal(sz, n)
}
f.Close()
f, err = os.Open("testdata/test.bmp")
if err != nil {
t.Fatal(err)
}
sz, n, err = DecodeSize(f)
if err != nil {
t.Fatal(err)
}
if sz.Width != 677 || sz.Height != 487 || n != "bmp" {
t.Fatal(sz, n)
}
f.Close()
f, err = os.Open("testdata/test.tiff")
if err != nil {
t.Fatal(err)
}
sz, n, err = DecodeSize(f)
if err != nil {
t.Fatal(err)
}
if sz.Width != 1032 || sz.Height != 1457 || n != "tiff" {
t.Fatal(sz, n)
}
f.Close()
}