This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

reading an image file  RSS feed

 
Rey Fernandez
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys! I'm planning to use java for the implementation of my research. In my program i need to read and render an image file pixel by pixel and i want to be able to manipulate every pixel, is this possible? how?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

If the image is a GIF, JPEG, BMP or PNG then you can use the javax.imageio.ImageIO class to read and write it. (TIFF and some others are also possible after installing an extra library). That class will hand you a java.awt.image.BufferedImage object, from which you can obtain a WriteableRaster object through which pixels can be manipulated.
 
Rey Fernandez
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Welcome to JavaRanch.

If the image is a GIF, JPEG, BMP or PNG then you can use the javax.imageio.ImageIO class to read and write it. (TIFF and some others are also possible after installing an extra library). That class will hand you a java.awt.image.BufferedImage object, from which you can obtain a WriteableRaster object through which pixels can be manipulated.


thank you.... what if i want to write my own image file format? i mean after reading a BMP, do some manipulation and then write it to a new file format my own image file format....
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rey Fernandez wrote:
Ulf Dittmer wrote:Welcome to JavaRanch.

If the image is a GIF, JPEG, BMP or PNG then you can use the javax.imageio.ImageIO class to read and write it. (TIFF and some others are also possible after installing an extra library). That class will hand you a java.awt.image.BufferedImage object, from which you can obtain a WriteableRaster object through which pixels can be manipulated.


thank you.... what if i want to write my own image file format? i mean after reading a BMP, do some manipulation and then write it to a new file format my own image file format....


Would like us to just do your research project for you? ;) Take a look at the APIs Ulf suggested. It helps to ask more specific questions and less about things you can do a bit of research to find out for yourself.
 
Rey Fernandez
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you I appreciated your offer but i really want to do it myself it's a part of the chellenge to do it myself.......
 
Campbell Ritchie
Sheriff
Posts: 55341
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch, Rey Fernandez
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!