python - How to read a raw image using PIL? -


I have a raw image where each pixel corresponds to an integer signed with 16 bits I call the PIL image as the following code Trying to read using the framestring () function:

  if __name__ == "__main__": if (len (sys.argv)! = 4): print 'error: Input logic disappears' sys.exit () file = open (sys.argv [1], 'rb') rawData = file.read () file.close () imgSize = (int (sys.argv [2]), int (Sys.argv [3])) PIL Raw Decoder for reading data To obtain access. # - 'F; 16 'indicates raw decoder that we are reading unsigned integer 16 bit data at a small end. Img = Image.fromstring ('L', imgSize, rawData, 'raw', 'f; 16') im.save ('out.png')  

PIL documents show that The first argument of the 'function' () function is 'mode', however, seeing the documentation and Goggling, I was not able to explain the logic that what exactly is the logic (I believe this color is related to space or so some). Does anyone know that I can get more detailed references about the fasting () function and what is the meaning of the dispute logic?

The specific documentation is as follows:

mode

The mode of an image defines the type and depth of a pixel in the image Current release supports the following standard mode:

  • 1 (1-bit pixels, black and white, RGB (3x8 bit pixel, right color)
  • P (8-bit pixels per pixel) , Map color to any other mode using the color palette
  • CMYK (4x8 bit pixel, color isolated)
  • RGBA (4x8 bit pixels, right color with transparent mask)
  • CMYK (4x8 bit pixel, color isolated)
  • F (32-bit floating point pixel)
  • P> PIL also provides limited support

  • Some specific modes, including LA (L alpha), RGAGX (true colors with padding) and R Ibia (including true color with alpha).

    Comments

    Popular posts from this blog

    Eclipse CDT variable colors in editor -

    AJAX doesn't send POST query -

    wpf - Custom Message Box Advice -