blob: 499e7ee3512cd469172a2a256254de268b4889f0 [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">
28 <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>
cristyd2432012015-05-04 23:15:15 +000047 <a class="magick-nav-item " href="binary-releases.html">Downloads</a>
48 <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>
50 <a class="magick-nav-item " href="api.html">Development</a>
cristy44443b92015-05-05 00:06:07 +000051 <a class="magick-nav-item" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristyabed55c2015-05-06 17:07:00 +000052 <a class="magick-nav-item navbar-right " href="http://www.imagemagick.org/script/search.php">Search</a>
cristyd2432012015-05-04 23:15:15 +000053 </nav>
54 </div>
55</div>
56<div class="container">
57<div class="magick-header">
58<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 +000059
cristyd2432012015-05-04 23:15:15 +000060<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 +000061
62<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>
63
cristyd2432012015-05-04 23:15:15 +000064<h2 class="magick-header"><a id="encipher"></a>Encipher an Image</h2>
cristy3ed852e2009-09-05 21:47:34 +000065
cristy751980d2012-06-03 23:18:35 +000066<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 +000067
cristy44443b92015-05-05 00:06:07 +000068<pre><span class="crtprompt"> </span><span class="crtin">convert rose.jpg -encipher passphrase.txt rose.png</span></pre>
cristybebec402010-04-23 19:19:08 +000069<p>Here we encipher an image using another image as the passphrase:</p>
cristy3ed852e2009-09-05 21:47:34 +000070
cristy44443b92015-05-05 00:06:07 +000071<pre><span class="crtprompt"> </span><span class="crtin">convert rose.jpg -encipher smiley.gif rose.png</span></pre>
cristyd2432012015-05-04 23:15:15 +000072<h2 class="magick-header"><a id="decipher"></a>Decipher an Image</h2>
cristy3ed852e2009-09-05 21:47:34 +000073
cristy751980d2012-06-03 23:18:35 +000074<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 +000075
cristy44443b92015-05-05 00:06:07 +000076<pre><span class="crtprompt"> </span><span class="crtin">convert rose.png -decipher passphrase.txt rose.jpg</span></pre>
cristyd2432012015-05-04 23:15:15 +000077<h2 class="magick-header"><a id="caveats"></a>Encipher and Decipher Caveats</h2>
cristy3ed852e2009-09-05 21:47:34 +000078
cristyd0bda5e2010-09-21 16:22:45 +000079<p>Some formats do not support enciphered pixels-- the JPEG or GIF format, for
80example. To ensure your image format is supported, encipher a test image and
cristyd2432012015-05-04 23:15:15 +000081verify you can restore its original content <var>before</var> you encipher any
cristyd0bda5e2010-09-21 16:22:45 +000082additional images in that format.</p>
cristy3ed852e2009-09-05 21:47:34 +000083
cristy8ee7f242013-06-20 16:08:44 +000084<p>The image format may only support 8-bit and RGB (TrueColor). As such you may
cristyd0bda5e2010-09-21 16:22:45 +000085like to include the options "-depth 8 -type TrueColor" before the output
cristy8ee7f242013-06-20 16:08:44 +000086filename.</p>
cristy3ed852e2009-09-05 21:47:34 +000087
cristyd0bda5e2010-09-21 16:22:45 +000088<p>The passphrase can be any combinations of letters and symbols. It should
89be a minimum of 12 character combinations to help ensure your image remains
90private. Also make sure your passphrase file permissions prevent others from
91reading it otherwise unintended users may be able to view the original image
92content.</p>
cristy3ed852e2009-09-05 21:47:34 +000093
cristyd0bda5e2010-09-21 16:22:45 +000094<p>You can only restore the original image content if you know your
95passphrase. If you lose or forget it, your original image content is lost
96forever.</p>
cristy3ed852e2009-09-05 21:47:34 +000097
cristyd0bda5e2010-09-21 16:22:45 +000098<p>ImageMagick only scrambles the image pixels. The image metadata remains
99untouched and readable by anyone with access to the image file.</p>
cristy3ed852e2009-09-05 21:47:34 +0000100
cristyd2432012015-05-04 23:15:15 +0000101<p>ImageMagick uses the <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES</a>
cristy8ee7f242013-06-20 16:08:44 +0000102cipher 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 +0000103
104<p>Currently only ImageMagick can restore your enciphered image content. We
cristy8ee7f242013-06-20 16:08:44 +0000105use a standard cipher and mode so other vendors are could support enciphered image content.</p>
cristyd0bda5e2010-09-21 16:22:45 +0000106
107<p>Some small practical examples of image enciphering can be found in IM
cristyd2432012015-05-04 23:15:15 +0000108Examples <a href="http://www.imagemagick.org/Usage/transform/#encipher">Encrypting Image Data</a>. </p>
cristy3ed852e2009-09-05 21:47:34 +0000109
cristybebec402010-04-23 19:19:08 +0000110</div>
cristyd2432012015-05-04 23:15:15 +0000111 <footer class="magick-footer">
112 <div class="magick-nav-item navbar-left">
cristy85893d32015-05-06 13:44:09 +0000113 <a href="support.html">Donate</a>
cristyd2432012015-05-04 23:15:15 +0000114 </div>
cristyd2432012015-05-04 23:15:15 +0000115 <p><a href="sitemap.html">Sitemap</a>
116 <a href="links.html">Related</a>
117 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
118 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
119 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
120</p>
121 <p><a href="cipher.html#">Back to top</a>
cristy85893d32015-05-06 13:44:09 +0000122 <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
cristy2f563d42015-05-06 23:36:51 +0000123 <p class="small">© 1999-2015 ImageMagick Studio LLC</p>
cristyd2432012015-05-04 23:15:15 +0000124 </footer>
125</div><!-- /.container -->
cristyad41c0c2012-10-31 00:49:28 +0000126
cristyd2432012015-05-04 23:15:15 +0000127 <script src="https://localhost/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
128 <script src="../js/bootstrap.min.js"></script>
129 <script type="text/javascript">
130 /* */
131 (function() {
132 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
133 s.type = 'text/javascript';
134 s.async = true;
135 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
136 t.parentNode.insertBefore(s, t);
137 })();
138 /* */
139 </script>
cristyad41c0c2012-10-31 00:49:28 +0000140</div>
cristyad41c0c2012-10-31 00:49:28 +0000141</body>
cristy5a367e42015-05-05 12:39:18 +0000142</html>