Skip to content

Commit 00d6076

Browse files
authored
add a sniffer for the XWD format (#4613)
otherwise we mistake it for TGA see #4612
1 parent 62a8564 commit 00d6076

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libvips/foreign/magick.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ magick_sniff(const unsigned char *bytes, size_t length)
138138
(bytes[4] != 0 || bytes[5] != 0))
139139
return "ICO";
140140

141+
if (length >= 8 &&
142+
bytes[1] == 0 &&
143+
bytes[2] == 0 &&
144+
bytes[5] == 0 &&
145+
bytes[6] == 0 &&
146+
(bytes[4] == 7 ||
147+
bytes[7] == 7))
148+
return "XWD";
149+
141150
if (length >= 18 &&
142151
(bytes[1] == 0 ||
143152
bytes[1] == 1) &&

0 commit comments

Comments
 (0)