title: Reading tiff raster data
body: <p>I'm reading a 2048X2048 pixels tiff file using the method below:</p>
  
  <pre><code>private static int[][] convertTo2DWithoutUsingGetRGB(BufferedImage image) {
  
      final short[] pixels = ((DataBufferUShort) image.getRaster().getDataBuffer()).getData();
  
      int[][] data = new int[2048][2048];
  
      int col = 0;
      int row = 0;
      int blockSize = 2048;
      for (int i=0; i&lt;pixels.length; i++) {
          data[col][row] = pixels[i];
          row++;
          if (row == blockSize) {
              col++;
              row = 0;
          }
      }
  
      return data;
  }   
  </code></pre>
  
  <p>But I keep getting negative values on my array, if I use gdal with python, for example:</p>
  
  <pre><code>import gdal # Tiff Image Read
  
  def getArrayFromImage(fileName):
      img = gdal.Open(fileName)
      return img.ReadAsArray().astype(int)
  </code></pre>
  
  <p>I get only positive values. In the java method above is there a treatment needed in the raw value to be a valid pixel for the tiff image?</p>