Page 1 of 1

How to make an small image invisible inside a large image

Posted: 2007-06-04T10:49:07-07:00
by fanaticjasper
and the small image still can be detected by Imagemagick.

thansks fanaticjasper!

Re: How to make an small image invisible inside a large image

Posted: 2007-06-04T13:39:20-07:00
by Bonzo
You want -stegano, there is some info on this page http://www.imagemagick.org/script/comma ... p?#stegano

BUT I think it is hard to view the image - need an X11 server ? Also if you are using it as an invisible watermark to prove the image is yours and the person who uses your image cuts anything off the top left corner you will probably not be able to find the image again anyway.

Re: How to make an small image invisible inside a large image

Posted: 2007-06-04T20:41:17-07:00
by anthony
The -stegano operatation is really more of a 'fun' operator. For example it could be use by a spy to hide info in the 'chaos' of a random image.

As a means of image copyright protection, it is useless. The smallest change to an image and the hidden data is lost.

This is why I haven't really added any example of its used in IM examples, as it is pretty useless.

The following is an example...

First the message (and get its size)

Code: Select all

  convert -gravity center label:"Watch\nthe\nBirdy" message.gif
  identify message.gif
Size is 36x43 whcih we will need...

Next the put it into some image...

Code: Select all

  convert rose:   rose_original.png
  composite message.gif rose: -stegano +15+5  rose_message.png
you can check the difference with compare

Code: Select all

  compare -metric PAE rose_original.png rose_message.png rose_difference.png
which shows the image was changed all over, but only a peak difference of 1 color unit (Whcih means JPEG will destroy the data.

now lets recover the hidden image...

Code: Select all

  convert -size 36x43+15+5 stegano:rose_message.png message_recovered.gif
Not that we needed the original images size and its offset for this to work!

if you get the size, or the offset wrong, or the image was modified, or even saved a JPEG, the message will be lost!

Re: How to make an small image invisible inside a large image

Posted: 2007-06-15T07:07:41-07:00
by fanaticjasper
Hi, may I have the source code for stegano?(any language:VB, C++, C#,C)

what does "1 color unit difference" mean? thanks you!

Re: How to make an small image invisible inside a large image

Posted: 2007-06-17T19:20:16-07:00
by anthony
A image is stores with with Red Green and Blue values saved as an 8 bot or 16 bit integer. A 1 color uint change means that value only changed by 1 (basically invisible)

Source code is in IM source . look for SteganoImage() in "magick/fx.h"

Re: How to make an small image invisible inside a large image

Posted: 2007-06-23T03:20:05-07:00
by fanaticjasper

Code: Select all

for (i=QuantumDepth-1; (i >= 0) && (j < QuantumDepth); i--)
  {
    for (y=0; (y < (long) watermark->rows) && (j < QuantumDepth); y++)
    {
      for (x=0; (x < (long) watermark->columns) && (j < QuantumDepth); x++)
      {
        pixel=AcquireOnePixel(watermark,x,y,exception);
        q=GetImagePixels(stegano_image,k % (long) stegano_image->columns,
          k/(long) stegano_image->columns,1,1);
        if (q == (PixelPacket *) NULL)
          break;
        switch (c)
        {
          case 0:
          {
            SetBit(q->red,j,GetBit(PixelIntensityToQuantum(&pixel),i));
            break;
          }
          case 1:
          {
            SetBit(q->green,j,GetBit(PixelIntensityToQuantum(&pixel),i));
            break;
          }
          case 2:
          {
           SetBit(q->blue,j,GetBit(PixelIntensityToQuantum(&pixel),i));
            break;
          }
        }
        if (SyncImagePixels(stegano_image) == MagickFalse)
          break;
        c++;
        if (c == 3)
          c=0;
        k++;
        if (k == (long) (stegano_image->columns*stegano_image->columns))
          k=0;
        if (k == image->offset)
          j++;
      }
    }
if a color's RGB value is 150,150,150, I change it to 150,150,151 and the change is so little that human eye can not see the difference. My question is how I can set an watermark color value to the image from the code above.

Re: How to make an small image invisible inside a large image

Posted: 2007-06-26T18:00:51-07:00
by anthony
Stegno is NOT a watermarking function.. If you make the changes visible as I did in IM Examples you will see garbage.
http://www.imagemagick.org/Usage/transform/#stegno

It hides images in images, it does not watermarks images.

For Watermarking See...
http://www.imagemagick.org/Usage/annotating/#watermark

Re: How to make an small image invisible inside a large image

Posted: 2007-06-26T21:34:41-07:00
by fanaticjasper
I want to hide an image in image.

The PNG image format supports 16 bit grayscale natively, although browsers and many imaging programs tend to ignore the low order 8 bits of each pixel.

if I have an image R(8bits) G(8bits) B(8bits) , does"Hide watermark in low-order bits of image " means expand to R(16bits) G(16bits) B(16bits) ....