diff --git a/magic/Magdir/images b/magic/Magdir/images
index e94905c..a25d292 100644
--- a/magic/Magdir/images
+++ b/magic/Magdir/images
@@ -32,17 +32,42 @@
# PBMPLUS images
# The next byte following the magic is always whitespace.
-0 search/1 P1 Netpbm PBM image text
+# strength is changed to try these patterns before "x86 boot sector"
+0 search/1 P1
+>3 regex =[0-9]*\ [0-9]* Netpbm PBM image text
+>3 regex =[0-9]+\ \b, size = %sx
+>>3 regex =\ [0-9]+ \b%s
+!:strength + 45
!:mime image/x-portable-bitmap
-0 search/1b P2 Netpbm PGM image text
+0 search/1 P2
+>3 regex =[0-9]*\ [0-9]* Netpbm PGM image text
+>3 regex =[0-9]+\ \b, size = %sx
+>>3 regex =\ [0-9]+ \b%s
+!:strength + 45
!:mime image/x-portable-greymap
0 search/1 P3 Netpbm PPM image text
+>3 regex =[0-9]*\ [0-9]* Netpbm PPM image text
+>3 regex =[0-9]+\ \b, size = %sx
+>>3 regex =\ [0-9]+ \b%s
+!:strength + 45
!:mime image/x-portable-pixmap
-0 string P4 Netpbm PBM "rawbits" image data
+0 string P4
+>3 regex =[0-9]*\ [0-9]* Netpbm PBM "rawbits" image data
+>3 regex =[0-9]+\ \b, size = %sx
+>>3 regex =\ [0-9]+ \b%s
+!:strength + 45
!:mime image/x-portable-bitmap
-0 string P5 Netpbm PGM "rawbits" image data
+0 string P5
+>3 regex =[0-9]*\ [0-9]* Netpbm PGM "rawbits" image data
+>3 regex =[0-9]+\ \b, size = %sx
+>>3 regex =\ [0-9]+ \b%s
+!:strength + 45
!:mime image/x-portable-greymap
-0 string P6 Netpbm PPM "rawbits" image data
+0 string P6
+>3 regex =[0-9]*\ [0-9]* Netpbm PPM "rawbits" image data
+>3 regex =[0-9]+\ \b, size = %sx
+>>3 regex =\ [0-9]+ \b%s
+!:strength + 45
!:mime image/x-portable-pixmap
0 string P7 Netpbm PAM image file
!:mime image/x-portable-pixmap