Pixel access and modify in JPG
Posted: 2008-11-07T07:07:36-07:00
Hello
first of all, sorry for my english.
I'm building a steganography system. I have to apply a "simil" LSB (least significant bit) concept to write on te lowest bits of a pixel to store a certain information (plain text's).
What i do for this is something like this:
This work's ok with format without destructive compression.
My problem is handling the jpg's format.
I see that Write rutine, aplies the compression algorithm of the format, wich destroy information, so i can't get it back.
Is there a way to modify the pixel's of a jpg without re-compressing the image?
i.e. is there a way to pixel-write jpg's and don't lose info?
sorry for the extension, and thank you for your answer
Sebastian.
first of all, sorry for my english.
I'm building a steganography system. I have to apply a "simil" LSB (least significant bit) concept to write on te lowest bits of a pixel to store a certain information (plain text's).
What i do for this is something like this:
Code: Select all
//...
//Read 1 pixel
pixel = my_pixel_cache.get(col, row, 1, 1);
red_int=pixel->red;
green_int=pixel->green;
blue_int=pixel->blue;
//Write in the BITS_ESTEGANOGRAFICOS lowest bits
int BITS_ESTEGANOGRAFICOS=3;
red_int >>= BITS_ESTEGANOGRAFICOS;
red_int <<= BITS_ESTEGANOGRAFICOS;
red_int |= red_toWrite;
//idem green and blue
//Save the pixel
memset(&pixel->red,red_int,sizeof(pixel->red));
//...
//Save the image
image.syncPixels();
image.write(path)
My problem is handling the jpg's format.
I see that Write rutine, aplies the compression algorithm of the format, wich destroy information, so i can't get it back.
Is there a way to modify the pixel's of a jpg without re-compressing the image?
i.e. is there a way to pixel-write jpg's and don't lose info?
sorry for the extension, and thank you for your answer
Sebastian.