Function Repository Resource:

SteganographyInsert

Source Notebook

Hide content in an image

Contributed by: Jon McLoone

ResourceFunction["SteganographyInsert"][image,content]

returns an image similar to image with content hidden within it.

ResourceFunction["SteganographyInsert"][image,content,form]

encodes content as form before hiding it within the image.

Details and Options

To the human eye, the output image will look the same as the input image, but the content is encoded in the least significant bit of each pixel color channel.
The content is not cryptographically encoded, only hidden. You should use Encrypt and Decrypt on the payload to make it secure, if discovered.
Lossy compression will destroy the hidden content. The resulting images should be saved in a lossless format such as uncompressed PNG.

Examples

Basic Examples (2) 

Hide a secret message in an image:

In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/2436b49b-a925-4167-9c90-7e9c18939363"]
Out[1]=

Recover the message using:

In[2]:=
ResourceFunction["SteganographyExtract"][img]
Out[3]=

Scope (1) 

You can specify the text encoding of the message for efficient representation. This effectively calls ExportString on the message first:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/5b5e729b-473d-47ae-8f3b-72ed75e3e99c"]
Out[4]=
In[5]:=
ResourceFunction["SteganographyExtract"][img]
Out[6]=

Possible Issues (1) 

The maximum message size depends on the size of the carrier image and must serialize into text of at most (3×8×height×width-320) bits. If you attempt to insert a larger message, the function will fail:

In[7]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/cbd93ac9-7ee4-4e41-b056-46664d46ffca"]
Out[7]=

Publisher

Jon McLoone

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 12 April 2019

Related Resources

License Information