title: Creating a Image from javafx2 2d Color list using bufferImage
body: <p>I am trying to convert my 2d list of Colors to an actual image and then export it, however, when I try to use it, it distorts the colors (shows the wrong ones)</p>
  
  <pre><code>import javafx.scene.paint.Color;
  
  import java.awt.image.BufferedImage;
  import java.io.File;
  import java.io.IOException;
  import java.util.List;
  
  import javax.imageio.ImageIO;
  
  public class ImageAction {
      public static void fromColorGrid(List&lt;List&lt;Color&gt;&gt; colorGrid) {
          int width = colorGrid.size();
          int height = colorGrid.get(0).size();
  
          BufferedImage buffImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
  
          // Set each pixel of the BufferedImage to the color from the Color[][].
          for (int x = 0; x &lt; width; x++) {
              for (int y = 0; y &lt; height; y++) {
                  String colorStr = colorGrid.get(x).get(y).toString().replace("0x", "");
                  int rgb = Integer.parseInt(colorStr, 16);
                  System.out.println(colorStr + "   " + rgb);
                  buffImage.setRGB(x, y, rgb);
              }
          }
          try {
              File outputfile = new File("saved.png");
              ImageIO.write(buffImage, "png", outputfile);
          } catch (IOException e) {
              System.out.println("Ups");
          }
      }
  }
  </code></pre>
  
  <p>Where am I going wrong?</p>