Wolfram Research

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

Hide a secret message in an image:

In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/ec90d563-0001-4696-bc5f-61f7343ba2ca"]
Out[1]=

Recover the message using:

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

Scope

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/6d7fd565-fafc-4d27-bb30-a2dfc6f9e051"]
Out[4]=
In[5]:=
ResourceFunction["SteganographyExtract"][img]
Out[6]=

Possible Issues

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/4fe09815-e17c-432a-b010-b702f2ac9fab"]
Out[7]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

See Also

License Information