blob: 8746f8ffe549b5692ea51795a02d121d0ff5f290 [file] [log] [blame]
cristy29dc8652015-05-12 16:26:21 +00001<!DOCTYPE html>
cristyd2432012015-05-04 23:15:15 +00002<html lang="en">
cristyad41c0c2012-10-31 00:49:28 +00003<head>
cristyd2432012015-05-04 23:15:15 +00004 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
cristyffb69ed2010-12-25 00:06:48 +00007 <title>ImageMagick: Encipher or Decipher an Image</title>
cristyd2432012015-05-04 23:15:15 +00008 <meta http-equiv="content-language" content="en-US">
9 <meta http-equiv="content-type" content="text/html; charset=utf-8">
10 <meta http-equiv="reply-to" content="magick-users@imagemagick.org">
11 <meta name="application-name" content="ImageMagick">
12 <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.">
13 <meta name="application-url" content="http://www.imagemagick.org">
14 <meta name="generator" content="PHP">
15 <meta name="keywords" content="encipher, or, decipher, an, image, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
16 <meta name="rating" content="GENERAL">
17 <meta name="robots" content="INDEX, FOLLOW">
18 <meta name="generator" content="ImageMagick Studio LLC">
19 <meta name="author" content="ImageMagick Studio LLC">
20 <meta name="revisit-after" content="2 DAYS">
21 <meta name="resource-type" content="document">
cristy2f563d42015-05-06 23:36:51 +000022 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
cristyd2432012015-05-04 23:15:15 +000023 <meta name="distribution" content="Global">
cristy44443b92015-05-05 00:06:07 +000024 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
cristyd2432012015-05-04 23:15:15 +000025 <link rel="icon" href="../images/wand.png">
26 <link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon">
cristy44443b92015-05-05 00:06:07 +000027 <link rel="stylesheet" href="css/bootstrap.min.css">
cristycecc9492015-06-09 16:53:50 +000028 <link rel="stylesheet" href="../css/magick.css">
cristyad41c0c2012-10-31 00:49:28 +000029</head>
30
cristyd2432012015-05-04 23:15:15 +000031<body>
cristyad41c0c2012-10-31 00:49:28 +000032<div class="main">
cristyd2432012015-05-04 23:15:15 +000033<div class="magick-masthead">
34 <div class="container">
35 <script type="text/javascript">
36 <!--
37 google_ad_client = "pub-3129977114552745";
38 google_ad_slot = "5439289906";
39 google_ad_width = 728;
40 google_ad_height = 90;
41 //-->
42 </script>
43 <center><script type="text/javascript" src="http://localhost/pagead/show_ads.js">
44 </script></center>
45 <nav class="magick-nav">
cristy44443b92015-05-05 00:06:07 +000046 <a class="magick-nav-item " href="../index.html">Home</a>
cristyea2793e2015-05-31 16:52:26 +000047 <a class="magick-nav-item " href="binary-releases.html">Download</a>
cristyd2432012015-05-04 23:15:15 +000048 <a class="magick-nav-item " href="command-line-tools.html">Tools</a>
49 <a class="magick-nav-item " href="command-line-options.html">Options</a>
cristyea2793e2015-05-31 16:52:26 +000050 <a class="magick-nav-item " href="resources.html">Resources</a>
51 <a class="magick-nav-item " href="api.html">Develop</a>
cristy5b8fe762015-06-09 16:24:03 +000052 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
cristya1890f02015-05-15 23:32:44 +000053 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristyd2432012015-05-04 23:15:15 +000054 </nav>
55 </div>
56</div>
57<div class="container">
58<div class="magick-header">
59<p class="text-center"><a href="cipher.html#encipher">Encipher an Image</a><a href="cipher.html#decipher">Decipher an Image</a><a href="cipher.html#caveats">Encipher and Decipher Caveats</a></p>
cristyad41c0c2012-10-31 00:49:28 +000060
cristyd2432012015-05-04 23:15:15 +000061<p class="lead magick-description">Most images, by design, are made to be viewed often and by many people. Web images, for example, may be viewed hundreds of times a day by a multitude of vistors. However, in some cases, you may want to keep a particular image private so that only you or perhaps a select group of your friends or web visitors can view it. ImageMagick permits you to scramble your images such that unless someone knows your passphrase, they will be unable to view the original content.</p>
cristy3ed852e2009-09-05 21:47:34 +000062
63<p>You could use an <a href="http://www.wizards-toolkit.org/www/encipher.html">enciphering</a> utility to scramble your image but they typically scramble the entire file making it unrecognizable as an image format. With ImageMagick, only the pixels are scrambled. The scrambled image continues to be recognized as an image and will even display in your web page. However, the content appears as gibberish, nothing like the original content.</p>
64
cristyd2432012015-05-04 23:15:15 +000065<h2 class="magick-header"><a id="encipher"></a>Encipher an Image</h2>
cristy3ed852e2009-09-05 21:47:34 +000066
cristy751980d2012-06-03 23:18:35 +000067<p>Use the <a href="command-line-options.html#encipher">-encipher</a> option to scramble your image so that it is unrecognizable. The option requires a filename that contains your passphrase. In this example we scramble an image and save it in the PNG format:</p>
cristy3ed852e2009-09-05 21:47:34 +000068
cristy82a2ff22015-05-12 16:41:32 +000069<pre>
70convert rose.jpg -encipher passphrase.txt rose.png
71</pre>
72
cristybebec402010-04-23 19:19:08 +000073<p>Here we encipher an image using another image as the passphrase:</p>
cristy3ed852e2009-09-05 21:47:34 +000074
cristy82a2ff22015-05-12 16:41:32 +000075<pre>
76convert rose.jpg -encipher smiley.gif rose.png
77</pre>
78
cristyd2432012015-05-04 23:15:15 +000079<h2 class="magick-header"><a id="decipher"></a>Decipher an Image</h2>
cristy3ed852e2009-09-05 21:47:34 +000080
cristy751980d2012-06-03 23:18:35 +000081<p>Use the <a href="command-line-options.html#decipher">-decipher</a> option to unscramble your image so that it is recognizable once again. The option requires a filename that contains your passphrase. In this example we unscramble an image and save it in the JPEG format:</p>
cristy3ed852e2009-09-05 21:47:34 +000082
cristy82a2ff22015-05-12 16:41:32 +000083<pre>
84convert rose.png -decipher passphrase.txt rose.jpg
85</pre>
86
cristyd2432012015-05-04 23:15:15 +000087<h2 class="magick-header"><a id="caveats"></a>Encipher and Decipher Caveats</h2>
cristy3ed852e2009-09-05 21:47:34 +000088
cristyd0bda5e2010-09-21 16:22:45 +000089<p>Some formats do not support enciphered pixels-- the JPEG or GIF format, for
90example. To ensure your image format is supported, encipher a test image and
cristyd2432012015-05-04 23:15:15 +000091verify you can restore its original content <var>before</var> you encipher any
cristyd0bda5e2010-09-21 16:22:45 +000092additional images in that format.</p>
cristy3ed852e2009-09-05 21:47:34 +000093
cristy8ee7f242013-06-20 16:08:44 +000094<p>The image format may only support 8-bit and RGB (TrueColor). As such you may
cristyd0bda5e2010-09-21 16:22:45 +000095like to include the options "-depth 8 -type TrueColor" before the output
cristy8ee7f242013-06-20 16:08:44 +000096filename.</p>
cristy3ed852e2009-09-05 21:47:34 +000097
cristyd0bda5e2010-09-21 16:22:45 +000098<p>The passphrase can be any combinations of letters and symbols. It should
99be a minimum of 12 character combinations to help ensure your image remains
100private. Also make sure your passphrase file permissions prevent others from
101reading it otherwise unintended users may be able to view the original image
102content.</p>
cristy3ed852e2009-09-05 21:47:34 +0000103
cristyd0bda5e2010-09-21 16:22:45 +0000104<p>You can only restore the original image content if you know your
105passphrase. If you lose or forget it, your original image content is lost
106forever.</p>
cristy3ed852e2009-09-05 21:47:34 +0000107
cristyd0bda5e2010-09-21 16:22:45 +0000108<p>ImageMagick only scrambles the image pixels. The image metadata remains
109untouched and readable by anyone with access to the image file.</p>
cristy3ed852e2009-09-05 21:47:34 +0000110
cristyd2432012015-05-04 23:15:15 +0000111<p>ImageMagick uses the <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES</a>
cristy8ee7f242013-06-20 16:08:44 +0000112cipher in Counter mode. We use the the first half of your passphrase to derive the nonce. The second half is the cipher key. When used correctly, AES-CTR provides a high level of confidentiality. To avoid information leaks, you must use a fresh passphrase for each image your encrypt.</p>
cristyd0bda5e2010-09-21 16:22:45 +0000113
114<p>Currently only ImageMagick can restore your enciphered image content. We
cristy8ee7f242013-06-20 16:08:44 +0000115use a standard cipher and mode so other vendors are could support enciphered image content.</p>
cristyd0bda5e2010-09-21 16:22:45 +0000116
117<p>Some small practical examples of image enciphering can be found in IM
cristyd2432012015-05-04 23:15:15 +0000118Examples <a href="http://www.imagemagick.org/Usage/transform/#encipher">Encrypting Image Data</a>. </p>
cristy3ed852e2009-09-05 21:47:34 +0000119
cristybebec402010-04-23 19:19:08 +0000120</div>
cristyd2432012015-05-04 23:15:15 +0000121 <footer class="magick-footer">
cristy82a2ff22015-05-12 16:41:32 +0000122 <div class="magick-nav-item pull-left">
cristy85893d32015-05-06 13:44:09 +0000123 <a href="support.html">Donate</a>
cristyd2432012015-05-04 23:15:15 +0000124 </div>
cristyd2432012015-05-04 23:15:15 +0000125 <p><a href="sitemap.html">Sitemap</a>
126 <a href="links.html">Related</a>
127 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
cristyea2793e2015-05-31 16:52:26 +0000128 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
cristyd2432012015-05-04 23:15:15 +0000129</p>
130 <p><a href="cipher.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000131 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy5b8fe762015-06-09 16:24:03 +0000132 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
cristya1890f02015-05-15 23:32:44 +0000133 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristyd2432012015-05-04 23:15:15 +0000134 </footer>
135</div><!-- /.container -->
cristyad41c0c2012-10-31 00:49:28 +0000136
cristyd2432012015-05-04 23:15:15 +0000137 <script src="https://localhost/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
138 <script src="../js/bootstrap.min.js"></script>
139 <script type="text/javascript">
cristy82a2ff22015-05-12 16:41:32 +0000140 /* <![CDATA[ */
cristyd2432012015-05-04 23:15:15 +0000141 (function() {
142 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
143 s.type = 'text/javascript';
144 s.async = true;
145 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
146 t.parentNode.insertBefore(s, t);
147 })();
cristy82a2ff22015-05-12 16:41:32 +0000148 /* ]]> */
cristyd2432012015-05-04 23:15:15 +0000149 </script>
cristyad41c0c2012-10-31 00:49:28 +0000150</div>
cristyad41c0c2012-10-31 00:49:28 +0000151</body>
cristy5a367e42015-05-05 12:39:18 +0000152</html>