Page 1 of 1

[SOLVED] Bit plane merging

Posted: 2016-11-29T02:18:40-07:00
by FloBEAUG
Hello,

I have found a way to do some steganography with imagemagick and it's capacity to extract bit planes, but now I'm stuck for merging the different bit planes.

I have two images A and B (same size):
A is the mask et B the secret i want to hide.
On A I do :

Code: Select all

convert A -fx '(int(u*255)&240)/255' A
to keep the 4 most significant bits.

On B I do :

Code: Select all

convert B -fx '(int(u*255)&240)/(255*16)' B
to keep the 4 most significant bits and shift them to the 4 less significant ones.

The question is : How do I merge A and B to make my final image C ?
Code to recover the secret :

Code: Select all

convert C -fx '(int(u*255)&15)*(16/255)' D 
P.S. Sorry for my English (french).

Re: Bit plane merging

Posted: 2016-11-29T06:59:10-07:00
by FloBEAUG
Hello again,

Finally found it by myself. Just have to add layers with this command :

Code: Select all

convert A B -background black -compose plus -layers flatten C
Here you can test with this image :
http://zupimages.net/viewer.php?id=16/48/1ika.png

To reveal the hidden secret just do :

Code: Select all

convert input.png -fx '(int(u*255)&15)*(16/255)' output.png