read image

Ads
 

read image

java code to read an image in the form of an array.

View Answers

May 9, 2011 at 4:22 PM

import java.io.*;
import javax.imageio.*;
import java.awt.image.*;
class ReadImageInArray 
{
    public static int[] getImagePixels(BufferedImage image)
{
    PixelGrabber grabber;
    int[] pixels = new int[image.getWidth() * image.getHeight()];
    try
    {
        grabber = new PixelGrabber(image, 0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
        grabber.grabPixels(0);

    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    return pixels;
}
    public static void main(String[] args) throws Exception
    {
        File input = new File("C:/rose.jpg");
        BufferedImage image = ImageIO.read(input);
      int array[]=getImagePixels(image);
      for(int i=0;i<array.length;i++){
          System.out.println(array[i]);
      }
    }
}

Ads









Related Tutorials/Questions & Answers:
read image
read image  java code to read an image in the form of an array.  ... ReadImageInArray { public static int[] getImagePixels(BufferedImage image...() * image.getHeight()]; try { grabber = new PixelGrabber(image, 0, 0
image
image  how to add the image in servlet code
Advertisements
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
image
image   Dear every body please help me how to add and retrive image and video into oracle 11g using jsp
image scrambling
image scrambling  Hi frinds : i want to read image and scrambling it then saved using java any help please
read paragraph
read paragraph  how to read paragraph from one file to another file
Read bufferedreader
Read bufferedreader  Tell me the example of Read file using bufferedreader. Thanks   Read the tutorial Reading file using BufferedReader class. Thanks
xl read
xl read  hi, i have read excel sheet data using poi api and printed on console, now i have to store the same data which is printed on the console...: Insert excel file data into database Read Excel File
read a file
read a file  read a file byte by byte   import java.io.File; import java.io.FileInputStream; public class ReadFileByteArray { public static void main(String[] args) { File file = new File("D://Try.txt"); try
Read Write
Read Write  Hi; How can I read certain line of say 10 text files and write to one text file   Java Read Multiple Files and store the data into another text file The given code reads all the text files of the directory
read xml
read xml   hi all, i want to ask about how to read an xml in java ME.. here is the xml file <data> <value> <struct> <member> <name> User_Name
image scrolling
image scrolling  A brief description of scrolling image
Image Steganography
Image Steganography  SOURCE CODE FOR IMAGE STEGANOGRAPHY
read xml elements
read xml elements  i want read xml data using sax parser in java. but is there any classes or methods to read xml elements
read xml elements
read xml elements  i want read xml data using sax parser in java. but is there any classes or methods to read xml elements
java read file
java read file  Hello i need some help... i want to read an MS Excel file in java so how to read that file
Read file in java
Read file in java  Hi, How to Read file in java? Thanks   Hi, Read complete tutorial with example at Read file in java. Thanks
How to read unread emails
How to read unread emails  How to read unread emails from account using POP3
How to read loops in Java
How to read loops in Java  Example that explains how to read loop in Java
how to read metatrader4?
how to read metatrader4?  how to read meta trader 4 using jsp
image format
image format  what are the different format available in image
image format
image format  what are the different format available in image
ModuleNotFoundError: No module named 'read'
ModuleNotFoundError: No module named 'read'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'read' How to remove the ModuleNotFoundError: No module named 'read' error
UIView Background Image
:@"myimage.png"]]; Read more at UIView Image Background Tutorial page. Thanks...UIView Background Image  HI, Please let's know how to add background image to a view? Thanks   Hi You can use the following code
Read and write file
Read and write file  HI, How to read and write file from Java program? Thanks   Hi, See the following tutorials: Java Write To File Read File Thanks
Read Bit values
Read Bit values  how to read bit values in the program Please give suggestion, which is useful in Simplified DES Algorithm
Read external file in PHP
Read external file in PHP  How to read external files in PHP in particular time duration and save that file with the latest date. How is it possible? Please explain with an example. Thanks
how to read metatrader4?
how to read metatrader4?  hi... i have to read data in a metatrader4 (MT4) using jsp, and the data should be stored in ms. sql server. how can i do that? Thank u
Read text File
Read text File  Hi,How can I get line and keep in a String in Java

Ads