@@ -0,0 +1,399 @@
+from imghdr import what%0A%0Adef validateImageHeader(image, okimages):%0A        imgtype = what(image)%0A        if imgtype in okimages:%0A                valid = %22True%22%0A        else:%0A                valid = %22False%22%0A        return valid%0A%0A# usage%0A#image = %22default.png%22%0A#okimages = %5B%22png%22,%22jpeg%22,%22gif%22,%22tiff%22%5D # other possible types: rgb, pbm, ppm, rast, xbm, bmp%0A#valid = validateImageHeader(image, okimages)%0A

Create validateimageheader.py