• Post Reply Bookmark Topic Watch Topic
  • New Topic

Image handling  RSS feed

 
Paul Tarbit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I am new here and pretty new to handling images in Java, as I am merely a student at university. However after several days looking I have turned here for help. I have been given the task to construct a compressor program for 3 images with the file extension PNG (.png). I have the actual code for the compression, but for it to work, I need to load the images in Java and then convert it into a binary (ie each pixel to the binary representation for it), file (or array) to input into the compressor. I have seen a lot of code on the internet and a lot are very complex, and I am merely looking for the very basic code to do it, and maybe if possible an explanation to go with it, or even better the algorithm of how it works. Any help here would be great,

Thanks very much for the time!
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably won't get the answer to your question since it's an assignment you are supposed to do on your own!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, we probably won't give the answer. However, this seems like a complicated enough task that I doubt anyone just *knows* the answer (unlike many questions posted on the beginner forum). Anyway, if I were working on this, I would look at the Image IO API. Check out the packages under the javax.imageio hierarchy. At the very least, it provides an easy way to read an image from a file. You will probably also need to use java.awt.Image or perhaps one of its subclasses, like java.awt.image.BufferedImage. One of these has a method to give you an array of RGB values. I suggest that you browse the Java API docs for descriptions for these classes and the methods they provide.

HTH

Layne
 
Paul Tarbit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help. Its not actually a marked assignment. The marking is done on the presentation of the working program. The problem is I need a working program to present. Its a lot more complex then I thought since I am not really fimilar with much Java yet, so thanks
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, let us know how things work out. We are more than happy to help if you encounter any problems. Just be sure to ask some specific questions, including code snippets, compiler errors, etc. to describe what the problem is.

Layne
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!