Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I take an image file and convert it into a raster and then access its data?

How do I take an image file and convert it into a raster and then access its data (RBG values) pixel by pixel?

like image 872
lancegerday Avatar asked Oct 24 '11 19:10

lancegerday


People also ask

Where do rasterized images store their data?

There are three methods to store image and raster data: as files in a file system, within a geodatabase, or managed from within the geodatabase but stored in a file system. This decision also involves determining whether to store all the data in a single dataset or in a catalog of potentially many datasets.

Can rasters store text values?

A raster will always store numerical values. However, if those values are small integers, the raster can have an attribute table. You can use "build raster attribute table" to build this table. You can add a field in this table and edit it to store the text values.

How is raster data stored?

Raster data is stored as a grid of values which are rendered on a map as pixels. Each pixel value represents an area on the Earth's surface. Vector data structures represent specific features on the Earth's surface, and assign attributes to those features.


1 Answers

BufferedImage img = ImageIO.read(new File("lol"));
int rgb = img.getRGB(x, y);

Color c = new Color(rgb);

Now you can use Color.getRed(), getGreen(), getBlue() and getAlpha() to get the different values

like image 167
Sibbo Avatar answered Oct 20 '22 00:10

Sibbo