code: def _to_image_array(file_path):
      
      _log.debug("File '%s' to image", file_path)
      data = numpy.fromfile(file_path, numpy.uint8)
      orig_len = len(data)
      pad_req = (3 - (orig_len % 3))
      pad_req += 3 if pad_req == 0 else 0
      final_len = orig_len + pad_req
      num_of_pixels = final_len // 3
      w, h = _determine_dimensions(num_of_pixels)
      reshaped = numpy.zeros((w, h, 3), dtype=numpy.uint8)
      for i in xrange(final_len):
          sidx = i // 3
          y = sidx % h
          x = sidx // h
          s = i % 3
          reshaped[x, y, s] = data[i] if i < orig_len else 0
      reshaped[-1, -1, 2] = pad_req
  
      return reshaped
docs: Converts the file in file_path to a numpy array (matrix) representing an RGB image
      The dimensions of the image are calculated using __determine_dimensions.
      Padding is added provide enough bytes to generate the image (between 1 and 3 bytes can be added).