BufferedImage image = null;
image = ImageIO.read(ne w File("D:\testim age.jpg"));
width=640;
height=480;
int[] rgbdata = new int[width*height];
image.getRGB(0, 0,width,height, rgbdata,0,width );
bytes = new byte[rgbdata.length];
pixelValues = new double[rgbdata.length];
for ( int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) (rgbdata[i] & 0xFF);
pixelValues[i] = (double)(rgbdat a[i]);
}
this is the code to read a test image s pixels into some array[]
now what wod be the code to scale the image to some desired resolution
say newwidth and newheight?
so that the testimage which was havin resolution 640*480 is now having newwidth*newhei ght as
its resolution wit newwidth*newhei ght already set beforehand.
its like i want the image to be scaled even before the pixels are manipulated for some purpose
image = ImageIO.read(ne w File("D:\testim age.jpg"));
width=640;
height=480;
int[] rgbdata = new int[width*height];
image.getRGB(0, 0,width,height, rgbdata,0,width );
bytes = new byte[rgbdata.length];
pixelValues = new double[rgbdata.length];
for ( int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) (rgbdata[i] & 0xFF);
pixelValues[i] = (double)(rgbdat a[i]);
}
this is the code to read a test image s pixels into some array[]
now what wod be the code to scale the image to some desired resolution
say newwidth and newheight?
so that the testimage which was havin resolution 640*480 is now having newwidth*newhei ght as
its resolution wit newwidth*newhei ght already set beforehand.
its like i want the image to be scaled even before the pixels are manipulated for some purpose
Comment