• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in loading/saving images using ImageIO  RSS feed

 
Neolithic Nikhil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone,

I'm working on a program based on steganography. For this, i need to access the individual pixels and perform my manipulations. FYI, I do not have the JAI library available with me and I have to make do with awt, imageIO and image. I'm having no issues in loading an image but when i thought I would test things and just save the same image without manipulation I was surprised. After copying the pixels from the image into an int array, I just created a new image with the same pixel array and image type. When I loaded the new image and compared both their pixels, the array was not the same! Can anyone tell me why this is happening and/or how I can get around this?

Here is some of my code:



Could really use your help here. I've tried "jpg", "jpeg" and various uppercase combination for the 'format' argument.

Thanks in advance,

Nikhil
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "Neolithic Nikhil"-

Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. It must consist of a first name and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do using the "My Profile" link at the top of the page.

As to your question, you can't use JPEG for steganography. JPEG relies on various compression techniques that pretty much ensure that you won't get pixel-by-pixel replicas of the image. You need to use a faithful format like PNG.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!