[SOLVED] Bit plane merging

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
FloBEAUG
Posts: 2
Joined: 2016-11-29T01:59:13-07:00
Authentication code: 1151

[SOLVED] Bit plane merging

Post 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).
Last edited by FloBEAUG on 2016-11-29T07:02:18-07:00, edited 3 times in total.
FloBEAUG
Posts: 2
Joined: 2016-11-29T01:59:13-07:00
Authentication code: 1151

Re: Bit plane merging

Post 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
Post Reply