hallo zusammen,
ich hab mal mein ppm bild in ein png umgewanddelt hab auch die breite und öhe vom bild.
nun wollt ich die rgb werte auslesen die müssen ja mit einer schleife ausgelesen werden.
Hab mir das so gedacht:
Also ich will die einzelnen Farbwerte erstmal extrahieren.
int[] argbArray = new int[ w * h ];
image.getRGB( 0 /* startX */, 0 /* startY */,
w, h, argbArray,
0 /* offset */, w /* scansize */ );
odeeeer? lieg ich da falsch..
EDIT:
es gibt 2 alternativen ... welche ist für denn hier entscheident:
int getRGB(int x, int y)
Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace.
int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, from a portion of the image data.
also ich will mir das bild anzeigen lassen.
lg
ich hab mal mein ppm bild in ein png umgewanddelt hab auch die breite und öhe vom bild.
nun wollt ich die rgb werte auslesen die müssen ja mit einer schleife ausgelesen werden.
Hab mir das so gedacht:
Code:
void lesen() throws IOException{
BufferedImage image = ImageIO.read( new File( "F:\\Users\\Jousef\\Documents\\galactic-center-fleck.png" ) );
int w = image.getWidth();
int h = image.getHeight();
for ( int i = 0; i < image.getWidth(); i ++ ){
for ( int j = 0; j < image.getHeight(); j++ ){
image.getRGB(i,j);
System.out.println(image.getRGB(i,j));
}
}
}
Also ich will die einzelnen Farbwerte erstmal extrahieren.
int[] argbArray = new int[ w * h ];
image.getRGB( 0 /* startX */, 0 /* startY */,
w, h, argbArray,
0 /* offset */, w /* scansize */ );
odeeeer? lieg ich da falsch..
EDIT:
es gibt 2 alternativen ... welche ist für denn hier entscheident:
int getRGB(int x, int y)
Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace.
int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, from a portion of the image data.
also ich will mir das bild anzeigen lassen.
lg
Zuletzt bearbeitet: