home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D2.iso / workshop / onlineco / files / ImageMagick-6.0.1-Q16-windows-dll.exe / {app} / PerlMagick / demo / steganography.pl < prev    next >
Encoding:
Perl Script  |  2003-12-29  |  619 b   |  27 lines

  1. #!/usr/bin/perl
  2.  
  3. use Image::Magick;
  4.  
  5. #
  6. # Create watermark.
  7. #
  8. $watermark=Image::Magick->new;
  9. $watermark->ReadImage('smile.gif');
  10. ($width, $height)=$watermark->Get('width','height');
  11. #
  12. # Hide watermark in image.
  13. #
  14. $image=Image::Magick->new;
  15. $image->ReadImage('model.gif');
  16. $image->SteganoImage(image=>$watermark,offset=>91);
  17. $image->Write('model.png');
  18. $image->Write('win:');
  19. #
  20. # Extract watermark from image.
  21. #
  22. $size="$width" . "x" . "$height" . "+91";
  23. $stegano=Image::Magick->new(size=>$size);
  24. $stegano->ReadImage('stegano:model.png');
  25. $stegano->Write('stegano.gif');
  26. $stegano->Write('win:');
  27.