Hi,

I am writing a simple c++ program that hides data in a PNG image by replacing insignificant bits with bits from a message on a linux box using the most recent release of ImageMagick. However, using the functions outlined in the Magick++ tutorial doesn't seem to modify the image.

Let's say I want to hide the number of bits I am going d to use to hide data in the first red pixel byte in the image.

Bits per byte used: 1
Red1 = 0 //read from the image
Red2 = 1 //modifed value that should replace the original red value

To do this, I read the color of the first pixel and then get the red value
//x=0,y=0
Color firstPix = original.pixelColor(x,y); //original is the image
unsigned char redVal = firstPix.redQuantum(); //MaxRGB = 255

After doing operations, redVal becomes the value I want (1) and then it is written
firstPix.redQuantum(modRedVal);

Then the rest of the image is read row by row (y staying the same)
x++;

However, a program that reads the value from the modifed image shows that the
values haven't changed:

Color firstPix = image.pixelColor(x,y); //(0,0);
unsigned char redVal = firstPix.redQuantum();

output with cout << (int) redVal
Red 1  = 0

which gives the wrong number of bits to use:
BitsUsed = 0
.
I've also tried using the PixelPacket approach, but this creates a black bar wheredata is being hidden. This shows that the image is being modified, but not correctly. The image I'm wor king with right now must be modified because its filesize is different from before.

Any help would be greatly appreciated in solving the problem.
Thanks,
Patrick
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to