Oracle Community Directory
Oracle Community FAQ
My Oracle Support Community (MOSC)
Go Directly To
Oracle Technology Network Community
My Oracle Support Community
OPN Cloud Connection
Oracle Employee Community
Oracle User Group Community
OTN Speaker Bureau
Java Advanced Imaging [ARCHIVE]
Please enter a title.
You can not post a blank message. Please type your message and try again.
This discussion is archived
: Oct 6, 2010 4:05 AM by
Convert BufferedImage to java awt Point Array
Oct 4, 2010 9:51 PM
I need to convert BufferedImage to java.awt.Point array. Am receiving Image as base64 string, then converting it to Byte and this array in converted to BufferedImage.
To do this I need to convert this to a java.awt.Point array. Am following the below steps. However the BufferedImage.getWriteableIndices seems to return 1 tile all the time.
String image = "image in base64 string"; // **** I can provide value for this if it helps, its a base64 string
byte buf = new sun.misc.BASE64Decoder().decodeBuffer(image);
InputStream in = new ByteArrayInputStream(buf,0,buf.length);
java.awt.Image buffImage = ImageIO.read(in);
int width = buffImage.getWidth(null);
int height = buffImage.getHeight(null);
int type = BufferedImage.TYPE_BYTE_GRAY; // you can experiment with this one
BufferedImage bi = new BufferedImage(width, height, type);
Graphics2D g2d = bi.createGraphics();
g2d.drawImage(buffImage, 0, 0, null);
java.awt.Point  myPoints = bi.getWritableTileIndices() ;
System.out.println("My Points size is "+myPoints.length); // This is always returning 1
Any kinda suggestion / direction would greatly help.
This content has been marked as final.
Show 1 reply
Re: Convert BufferedImage to java awt Point Array
Oct 6, 2010 4:05 AM
in response to
What does it mean to store an image as a point array? A java.awt.Point is two integers representing an (x,y) coordinate. A pixel is a single integer representing an rgb value. They appear to be two different concepts, or am I missing something?