diff --git a/resources/gif-animated.GIF_Animated-macos-14_arm64_libvips-8.15.3.golden.gif b/resources/gif-animated.GIF_Animated-macos-14_arm64_libvips-8.15.3.golden.gif new file mode 100644 index 00000000..857cacd5 Binary files /dev/null and b/resources/gif-animated.GIF_Animated-macos-14_arm64_libvips-8.15.3.golden.gif differ diff --git a/resources/gif-animated.GIF_Animated_ExportNative-macos-14_arm64_libvips-8.15.3.golden.gif b/resources/gif-animated.GIF_Animated_ExportNative-macos-14_arm64_libvips-8.15.3.golden.gif new file mode 100644 index 00000000..aa5ac10b Binary files /dev/null and b/resources/gif-animated.GIF_Animated_ExportNative-macos-14_arm64_libvips-8.15.3.golden.gif differ diff --git a/vips/foreign.go b/vips/foreign.go index 80f643b4..861f076d 100644 --- a/vips/foreign.go +++ b/vips/foreign.go @@ -154,14 +154,14 @@ func DetermineImageType(buf []byte) ImageType { return ImageTypeHEIF } else if isSVG(buf) { return ImageTypeSVG - } else if isPDF(buf) { - return ImageTypePDF } else if isBMP(buf) { return ImageTypeBMP } else if isJP2K(buf) { return ImageTypeJP2K } else if isJXL(buf) { return ImageTypeJXL + } else if isPDF(buf) { + return ImageTypePDF } else { return ImageTypeUnknown } @@ -240,7 +240,7 @@ func isSVG(buf []byte) bool { var pdf = []byte("\x25\x50\x44\x46") func isPDF(buf []byte) bool { - return bytes.HasPrefix(buf, pdf) + return bytes.Contains(buf[:1024], pdf) } var bmpHeader = []byte("BM")