tag:blogger.com,1999:blog-5179424209655851112024-02-08T05:09:06.616-08:00SXEmacs-enBlog about SXEmacslghttp://www.blogger.com/profile/08003803875490377611noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-517942420965585111.post-60270679117143042252009-12-27T17:37:00.003-08:002009-12-27T17:37:41.798-08:00Sudoku for (S)XEmacs
<div xmlns='http://www.w3.org/1999/xhtml'>
<p class='fl'>Once a night, there was no soft girlfriend at the side and I decided to play in some game. Tetris is to fast and active, sokoban is completed long ago and World of Goo heats CPU too much — so I choose sudoku. Opened <a href='http://websudoku.com' class='reference external'>websudoku.com</a> and started playing. Everything is ok, but that is not under SXEmacs and not available offline. Decided to write <tt class='docutils literal'><span class='pre'>sudoku.el</span></tt> to play sudoku under SXEmacs. Skim over the internet and found <a href='http://www.columbia.edu/~jr2075/sudoku.el' class='reference external'>sudoku.el</a> for (X)Emacs. Downloaded, started and disappointed, looked to the code and got depression. So night was spent rewriting <tt class='docutils literal'><span class='pre'>sudoku.el</span></tt> to satisfy my needs, namely:</p><ul class='simple'><li>Handy, eye-candy and informative interface</li>
<li>Possibility to download sudokus from <a href='http://websudoku.com' class='reference external'>websudoku.com</a> and <a href='http://menneske.no/sudoku/' class='reference external'>menneske.no</a></li>
<li>Possibility to print sudokus</li>
<li>Possibility to edit sudokus</li>
<li>Possibility to save/load sudokus</li>
<li>Pencils for master techniques</li>
<li>Easy cells autocompletion, so you solve only hard part of the puzzle</li>
</ul><div id='example' class='section'><h2>Example</h2>
<p>Let's run <tt class='docutils literal'><span class='pre'>M-x</span> <span class='pre'>sudoku</span> <span class='pre'>RET</span></tt>:</p><div class='align-center' align='center'><img style='width: 1080px; height: 710px;' src='http://lgarc.narod.ru/sxemacsen/img/sud1.png' class='align-center' alt='sudoku-mode'/></div>
<p>Here is a bunch of easy cells, for example R5C5 (where cursor is) and of course we are to lazy to fill them, so let's press <tt class='docutils literal'><span class='pre'>a</span></tt>, we will get:</p><div class='align-center' align='center'><img style='width: 1080px; height: 710px;' src='http://lgarc.narod.ru/sxemacsen/img/sud2.png' class='align-center' alt='autoinsert'/></div>
<p>Now is really hard part of the puzzle, but peculiarity for the value 4 is seen, so we get the pencil — <tt class='docutils literal'><span class='pre'>p</span></tt> and use <a href='http://www.sadmansoftware.com/sudoku/nishio.htm' class='reference external'>Nishio</a> technique, starting from R8C9 cell:</p><div class='align-center' align='center'><img style='width: 1080px; height: 710px;' src='http://lgarc.narod.ru/sxemacsen/img/sud3.png' class='align-center' alt='pencil'/></div>
<ol class='arabic simple'><li>R8C9 -> 4 (<a href='http://www.sadmansoftware.com/sudoku/nishio.htm' class='reference external'>Nishio</a> start)</li>
<li>R2C3 -> 4 (only cell in C3 where 4 can be)</li>
<li>R3C7 -> 4 (only cell in R1 where 4 can be)</li>
<li>No place for 4 in 8th square</li>
</ol>
<p>So 4 can't be in R8C9. <tt class='docutils literal'><span class='pre'>C-u</span> <span class='pre'>p</span></tt> to cancel the pencil. Now we know that 4 is in R2C9:</p><div class='align-center' align='center'><img style='width: 1080px; height: 710px;' src='http://lgarc.narod.ru/sxemacsen/img/sud4.png' class='align-center' alt='won'/></div>
<p>Nice sudoku. I like it, my son will like it too, so let's print it with <tt class='docutils literal'><span class='pre'>P</span></tt>. On the paper it will look like this:</p><div class='align-center' align='center'><img style='width: 640px; height: 716px;' src='http://lgarc.narod.ru/sxemacsen/img/sud5.png' class='align-center' alt='printed'/></div>
</div><div id='download' class='section'><h2>Download</h2>
<p>Download from <a href='http://lgarc.narod.ru/xemacs/sudoku.el' class='reference external'>http://lgarc.narod.ru/xemacs/sudoku.el</a></p><p>Send notices, bugreports, fixes to <tt class='docutils literal'><span class='pre'>lg</span> <span class='pre'>AT</span> <span class='pre'>sxemacs.org</span></tt></p></div>
</div>
lghttp://www.blogger.com/profile/08003803875490377611noreply@blogger.com0tag:blogger.com,1999:blog-517942420965585111.post-25144093414843468552009-12-27T17:08:00.001-08:002009-12-27T17:08:16.467-08:00Buttons generator
<div xmlns='http://www.w3.org/1999/xhtml'>
<p class='fl'>There is outstanging package in (S)XEmacs called <tt class='docutils literal'><span class='pre'>xpm-button.el</span></tt>. It can generate button image on fly. It is very handy, but eye-ugly results depresses much. So I decided to write flexibly generator for eye-candy buttons, using <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt>. While implementing it, I also extended <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> to get necessary functionality. Here is what I've got:</p><div class='highlight'><pre><span style='color: #696969'>(</span><span style='color: #000000'>wand-button</span> <span style='color: #000000'>150</span> <span style='color: #000000'>32</span> <span style='color: #008B00'>"Wand Button"</span>
<span style='color: #CD0000'>:bg</span> <span style='color: #008B00'>"cornflowerblue"</span> <span style='color: #CD0000'>:fg</span> <span style='color: #008B00'>"white"</span>
<span style='color: #CD0000'>:round</span> <span style='color: #000000'>8.0</span> <span style='color: #CD0000'>:depth</span> <span style='color: #000000'>1</span> <span style='color: #CD0000'>:yoff</span> <span style='color: #000000'>8</span> <span style='color: #00008b; font-style: italic'>; :type 'pressed</span>
<span style='color: #CD0000'>:wand-font</span> <span style='color: #696969'>(</span><span style='color: #000000'>make-wand-font</span> <span style='color: #CD0000'>:family</span> <span style='color: #008B00'>"Zapfino"</span><span style='color: #696969'>))</span>
</pre></div>
<p>→ <img style='width: 323px; height: 42px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-button1.png' alt='button1'/></p><div class='highlight'><pre><span style='color: #696969'>(</span><span style='color: #000000'>wand-button</span> <span style='color: #000000'>100</span> <span style='color: #000000'>20</span> <span style='color: #008B00'>"Wand Button"</span>
<span style='color: #CD0000'>:bg</span> <span style='color: #008B00'>"gray80"</span> <span style='color: #CD0000'>:fg</span> <span style='color: #008B00'>"black"</span> <span style='color: #CD0000'>:round</span> <span style='color: #000000'>10.0</span>
<span style='color: #CD0000'>:contrast</span> <span style='color: #000000'>0.5</span> <span style='color: #CD0000'>:depth</span> <span style='color: #000000'>2</span> <span style='color: #00008b; font-style: italic'>; :type 'pressed</span>
<span style='color: #CD0000'>:wand-font</span> <span style='color: #696969'>(</span><span style='color: #000000'>make-wand-font</span> <span style='color: #CD0000'>:family</span> <span style='color: #008B00'>"Copperplate"</span><span style='color: #696969'>))</span>
</pre></div>
<p>→ <img style='width: 224px; height: 28px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-button2.png' alt='button2'/></p><div class='highlight'><pre><span style='color: #696969'>(</span><span style='color: #000000'>wand-button</span> <span style='color: #000000'>100</span> <span style='color: #000000'>40</span> <span style='color: #696969'>(</span><span style='color: #000000'>encode-coding-string</span> <span style='color: #008B00'>"привет"</span> <span style='color: #CD0000'>'utf-8</span><span style='color: #696969'>)</span>
<span style='color: #CD0000'>:bg</span> <span style='color: #008B00'>"palegreen"</span> <span style='color: #CD0000'>:fg</span> <span style='color: #008B00'>"green"</span> <span style='color: #CD0000'>:round</span> <span style='color: #000000'>0.0</span>
<span style='color: #CD0000'>:depth</span> <span style='color: #000000'>4</span> <span style='color: #CD0000'>:yoff</span> <span style='color: #000000'>-2</span> <span style='color: #00008b; font-style: italic'>; :type 'pressed</span>
<span style='color: #CD0000'>:wand-font</span> <span style='color: #696969'>(</span><span style='color: #000000'>make-wand-font</span> <span style='color: #CD0000'>:family</span> <span style='color: #008B00'>"Arial Black"</span>
<span style='color: #CD0000'>:size</span> <span style='color: #000000'>20</span><span style='color: #696969'>))</span>
</pre></div>
<p>→ <img style='width: 225px; height: 50px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-button3.png' alt='button2'/></p><p>Quite interesting to integrate this functionality into the SXEmacs widgets. Current implementation of buttons (using ugly static images) is far from ideal.</p>
</div>
lghttp://www.blogger.com/profile/08003803875490377611noreply@blogger.com0tag:blogger.com,1999:blog-517942420965585111.post-55680607869203911412009-12-27T16:38:00.001-08:002009-12-27T16:38:01.181-08:00Wand-mode - new features
<div xmlns='http://www.w3.org/1999/xhtml'>
<p class='fl'>Wand-mode evolves. Some new features has been added since I've posted <a href='http://sxemacs-en.blogspot.com/2009/12/wand-mode-image-viewer.html' class='reference external'>Wand-mode description</a>. I'll describe them.</p><div id='new-features' class='section'><h2>New features</h2>
<ul class='simple'><li><a href='#filename-in-the-buffer-name' class='reference internal'>Filename in the buffer name</a></li>
<li><a href='#support-for-iptc-profile' class='reference internal'>Support for IPTC profile</a></li>
<li><a href='#simple-exif-data-properties-editor' class='reference internal'>Simple EXIF data (properties) editor</a></li>
<li><a href='#new-operation-fit-to-size' class='reference internal'>New operation: fit to size</a></li>
<li><a href='#new-operation-modulate' class='reference internal'>New operation: modulate</a></li>
<li><a href='#new-operation-grayscale' class='reference internal'>New operation: grayscale</a></li>
<li><a href='#global-operations' class='reference internal'>Global operations</a></li>
<li><a href='#pixel-color-picker' class='reference internal'>Pixel color picker</a></li>
</ul></div><div id='filename-in-the-buffer-name' class='section'><h2>Filename in the buffer name</h2>
<p>Let's open some image: <tt class='docutils literal'><span class='pre'>C-x</span> <span class='pre'>C-f</span> <span class='pre'>lg-tree.jpg</span> <span class='pre'>RET</span></tt>, we will get something like:</p><div class='align-center' align='center'><img style='width: 500px; height: 324px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-update1/1.png' class='align-center' alt='orig image'/></div>
<p>Take a look at <tt class='docutils literal'><span class='pre'>mode-line</span></tt> and notice that there is filename contained in the buffer name. This is very handy when switching buffers with <tt class='docutils literal'><span class='pre'>C-x</span> <span class='pre'>C-b</span></tt>.</p></div><div id='new-operation-modulate' class='section'><h2>New operation: modulate</h2>
<p>This picture is nice, but nature looks despondently, so let us colour the truth using next command <tt class='docutils literal'><span class='pre'>o</span> <span class='pre'>modulate</span> <span class='pre'>RET</span> <span class='pre'>saturation</span> <span class='pre'>RET</span> <span class='pre'>60</span>
<span class='pre'>RET</span></tt>. We will get:</p><div class='figure' align='center'><img style='width: 660px; height: 350px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-update1/3.png' alt='sat inc 60 percents'/>
<p class='caption'>60% increased saturation</p></div><p>This is much better.</p></div><div id='support-for-iptc-profile' class='section'><h2>Support for IPTC profile</h2>
<p>We want to add some information related to the photo, what is this and where all this happens. Let's add <acronym title='International Press Telecommunications Council, metadata attributes applied to image'>IPTC</acronym> tags using <tt class='docutils literal'><span class='pre'>p</span> <span class='pre'>caption</span> <span class='pre'>RET</span> <span class='pre'>lg</span>
<span class='pre'>climbs</span> <span class='pre'>trees</span> <span class='pre'>RET</span></tt> and <tt class='docutils literal'><span class='pre'>p</span> <span class='pre'>keywords</span> <span class='pre'>RET</span> <span class='pre'>js-kit,</span> <span class='pre'>corporative</span> <span class='pre'>RET</span></tt>. We'll get:</p><div class='figure' align='center'><img style='width: 660px; height: 400px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-update1/4.png' alt='caption and keywords added'/>
<p class='caption'>Caption and Keywords added</p></div></div><div id='pixel-color-picker' class='section'><h2>Pixel color picker</h2>
<p>Wonder what is the color of my shorts, let's click on them:</p><div class='figure' align='center'><img style='width: 760px; height: 430px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-update1/5.png' alt='pixel color picker'/>
<p class='caption'>Pixel color picker</p></div><p>Pixel coordinates, it's color and RGB values are displayed. Very handy.</p></div><div id='global-operations' class='section'><h2>Global operations</h2>
<p>Sometimes you need to view bunch of images applying certain operations stack, for example zoom-in. For this purpose there is command to fixate current operations, bound to <tt class='docutils literal'><span class='pre'>O</span></tt> by default. Let's press <tt class='docutils literal'><span class='pre'>O</span></tt> and follow up to next image with <tt class='docutils literal'><span class='pre'>SPC</span></tt>.</p><div class='figure' align='center'><img style='width: 750px; height: 480px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-update1/6.png' alt='global operations'/>
<p class='caption'>Global operations applied</p></div><p>We see global operations, and also notice that those operations was automatically applied to the image. However increased saturation is not suitable for this photo, so we cancel it with <tt class='docutils literal'><span class='pre'>undo</span></tt> (<tt class='docutils literal'><span class='pre'>C-/</span></tt>):</p><div class='figure' align='center'><img style='width: 740px; height: 450px;' src='http://lgarc.narod.ru/sxemacsen/img/wand-update1/7.png' alt='operations canceled'/>
<p class='caption'>Operations canceled</p></div><p>To reset global operations press <tt class='docutils literal'><span class='pre'>C-u</span> <span class='pre'>O</span></tt>.</p></div><div id='simple-exif-data-properties-editor' class='section'><h2>Simple EXIF data (properties) editor</h2>
<p>Sometimes you need to edit <acronym title='Exchangeable Image File Format'>EXIF</acronym> data. I don't use this functionality, <acronym title='International Press Telecommunications Council, metadata attributes applied to image'>IPTC</acronym> profiles are enough for me, however friend of mine asked for it. It is not that hard for couple of beers. Start editor with <tt class='docutils literal'><span class='pre'>e</span></tt> key. It will filter out image properties according to <tt class='docutils literal'><span class='pre'>Wand-mode-properties-pattern</span></tt> ("^exif:" by default).</p></div><div id='new-operation-grayscale' class='section'><h2>New operation: grayscale</h2>
<p>There are many methods to make image be black&white. Simplest and greatest one is to zerofy the saturation with <tt class='docutils literal'><span class='pre'>o</span> <span class='pre'>modulate</span> <span class='pre'>RET</span>
<span class='pre'>saturation</span> <span class='pre'>RET</span> <span class='pre'>-100</span> <span class='pre'>RET</span></tt> command. However <tt class='docutils literal'><span class='pre'>o</span> <span class='pre'>grayscale</span> <span class='pre'>RET</span></tt> operation has been added for your convenience.</p></div><div id='new-operation-fit-to-size' class='section'><h2>New operation: fit to size</h2>
<p>If you need scale image to fit into given box, then use <tt class='docutils literal'><span class='pre'>o</span> <span class='pre'>fit</span> <span class='pre'>to</span>
<span class='pre'>size</span> <span class='pre'>RET</span></tt> operation. It will use <tt class='docutils literal'><span class='pre'>Wand-mode-scaler</span></tt> procedure to perform scaling. You can create custom scalers with <tt class='docutils literal'><span class='pre'>Wand-make-scaler</span></tt> macro. Pretty good scaler might look like:</p><div class='highlight'><pre><span style='color: #696969'>(</span><span style='color: #4682B4'>setq</span> <span style='color: #000000'>Wand-mode-scaler</span>
<span style='color: #696969'>(</span><span style='color: #000000'>Wand-make-scaler</span> <span style='color: #CD0000'>:GaussianFilter</span> <span style='color: #000000'>1</span><span style='color: #696969'>))</span>
</pre></div>
<p>Take a look at docstrings for <tt class='docutils literal'><span class='pre'>Wand-mode-scaler</span></tt> and <tt class='docutils literal'><span class='pre'>Wand-make-scaler</span></tt> for exhaustive information.</p></div>
</div>
lghttp://www.blogger.com/profile/08003803875490377611noreply@blogger.com0tag:blogger.com,1999:blog-517942420965585111.post-85070244581654020972009-12-27T16:35:00.001-08:002009-12-27T16:35:42.311-08:00Wand-mode - image viewer
<div xmlns='http://www.w3.org/1999/xhtml'>
<p class='fl'><tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> is the special mode to view and edit images under SXEmacs. <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> is based on <a href='http://www.imagemagick.org/' class='reference external'>ImageMagick</a> <acronym title='Application Programming Interface'>API</acronym> therefore it can perform action usually done by programs such as <tt class='docutils literal'><span class='pre'>convert(1)</span></tt>, <tt class='docutils literal'><span class='pre'>display(1)</span></tt> etc. <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> supports all the formats handled by <a href='http://www.imagemagick.org/' class='reference external'>ImageMagick</a>; there are over 100 formats including <acronym title='Portable Document Format'>PDF</acronym>, EPS, etc.</p><div id='getting-started-with-wand-mode' class='section'><h2>Getting started with <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt></h2>
<p>Using <tt class='docutils literal'><span class='pre'>M-x</span> <span class='pre'>Wand-display</span> <span class='pre'>RET</span> <span class='pre'>/path/to/image.jpg</span> <span class='pre'>RET</span></tt> we will get something like:</p><div class='align-center' align='center'><img style='width: 500px; height: 260px;' src='http://lgarc.narod.ru/sxemacsen/img/wd-500.jpg' class='align-center' alt='Wand-display sample'/></div>
<p>To get file info we press <tt class='docutils literal'><span class='pre'>i</span></tt>:</p><div class='align-center' align='center'><img style='width: 500px; height: 260px;' src='http://lgarc.narod.ru/sxemacsen/img/wdi-500.jpg' class='align-center' alt='Wand-display identify'/></div>
<p>Now let us enhance this image a little. We want to remove noise and decrease contrast a little. Use <tt class='docutils literal'><span class='pre'>o</span> <span class='pre'>despeckle</span> <span class='pre'>RET</span></tt> and then <tt class='docutils literal'><span class='pre'>o</span> <span class='pre'>contrast</span> <span class='pre'>RET</span> <span class='pre'>decrease</span> <span class='pre'>RET</span></tt>. Don't worry, completion will work everywhere. We'll get the result:</p><div class='align-center' align='center'><img style='width: 500px; height: 260px;' src='http://lgarc.narod.ru/sxemacsen/img/wd-edit-500.jpg' class='align-center' alt='Wand-display edit'/></div>
</div><div id='viewing-image-directories' class='section'><h2>Viewing image directories</h2>
<p><tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> has simple yet very handy navigation possibilities to view images. Open any file with <tt class='docutils literal'><span class='pre'>Wand-display</span></tt>, if there any other image files (supported by <a href='http://www.imagemagick.org/' class='reference external'>ImageMagick</a>) in the directory, then you can open them using next keys:</p><ul class='simple'><li><tt class='docutils literal'><span class='pre'>Space</span></tt> - Next image</li>
<li><tt class='docutils literal'><span class='pre'>BackSpace</span></tt> - Previous image</li>
<li><tt class='docutils literal'><span class='pre'>M-<</span></tt> - Very first image in the directory (in alphabet order)</li>
<li><tt class='docutils literal'><span class='pre'>M-></span></tt> - Last image in the directory</li>
</ul></div><div id='pages-navigation' class='section'><h2>Pages navigation</h2>
<p>When viewing multi-page <em>images</em> such as <acronym title='Portable Document Format'>PDF</acronym>, EPS, MPEG, etc you can navigate across the pages with next keystrokes:</p><ul class='simple'><li><tt class='docutils literal'><span class='pre'>PgDown</span></tt> - Next page</li>
<li><tt class='docutils literal'><span class='pre'>PgUp</span></tt> - Previous page</li>
<li><tt class='docutils literal'><span class='pre'>Home</span></tt> - Jump to the first page</li>
<li><tt class='docutils literal'><span class='pre'>End</span></tt> - Last page</li>
<li><tt class='docutils literal'><span class='pre'>g</span></tt> or <tt class='docutils literal'><span class='pre'>M-g</span></tt> - Select the page. You can either pass page number via universal argument (<tt class='docutils literal'><span class='pre'>C-u</span></tt>) or type it interactively.</li>
</ul><p>Of course <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> is not <tt class='docutils literal'><span class='pre'>xpdf</span></tt> or <tt class='docutils literal'><span class='pre'>gv</span></tt>, however it is pretty handle to skim over the document or for picking and saving particular page from book or video file.</p><p>If you set <tt class='docutils literal'><span class='pre'>Wand-mode-show-fileinfo</span></tt> variable to non-<tt class='docutils literal'><span class='pre'>nil</span></tt> value, then information about current page and total number of pages will be displayed.</p><p>Also note that any operation you apply, applies only to current page and not to whole bunch of pages in the <em>image</em>.</p></div><div id='wand-mode-menu' class='section'><h2><tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> Menu</h2>
<p><tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> has nice menu (resembling <tt class='docutils literal'><span class='pre'>display(1)</span></tt> menu) to work with images:</p><div class='align-center' align='center'><img style='width: 500px; height: 260px;' src='http://lgarc.narod.ru/sxemacsen/img/wd-menu-500.jpg' class='align-center' alt='Wand-display menu'/></div>
<p>You can reach menu either from <tt class='docutils literal'><span class='pre'>menubar</span></tt> (if enabled), or using right button on your mouse. All commands available through the keyboard are available via menu and vice versa.</p></div><div id='customizing-wand-mode' class='section'><h2>Customizing <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt></h2>
<p><tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> has few parameters to change it's behavior. Use <tt class='docutils literal'><span class='pre'>M-x</span> <span class='pre'>customize-group</span> <span class='pre'>RET</span> <span class='pre'>Wand-mode</span> <span class='pre'>RET</span></tt> to change them. Here is a little description of most want-to-customize parameters:</p><ul><li><p class='first'><tt class='docutils literal'><span class='pre'>Wand-mode-zoom-factor</span></tt> - Number (default: <tt class='docutils literal'><span class='pre'>2</span></tt>)</p><p>As you can notice from it's name, this is the coefficient for <tt class='docutils literal'><span class='pre'>+</span></tt> (zoom-in) and <tt class='docutils literal'><span class='pre'>-</span></tt> (zoom-out) commands.</p></li>
<li><p class='first'><tt class='docutils literal'><span class='pre'>Wand-mode-show-fileinfo</span></tt> - Boolean (default: <tt class='docutils literal'><span class='pre'>t</span></tt>)</p><p>When non-<tt class='docutils literal'><span class='pre'>nil</span></tt>, then display some information about the file, for more info, as was already noticed above, use <tt class='docutils literal'><span class='pre'>i</span></tt> command.</p></li>
<li><p class='first'><tt class='docutils literal'><span class='pre'>Wand-mode-show-operations</span></tt> - Boolean (default: <tt class='docutils literal'><span class='pre'>t</span></tt>)</p><p>When non-<tt class='docutils literal'><span class='pre'>nil</span></tt>, then display image operations stack. You can use undo/redo commands even if <tt class='docutils literal'><span class='pre'>Wand-mode-show-operations</span></tt> is <tt class='docutils literal'><span class='pre'>nil</span></tt>.</p></li>
<li><p class='first'><tt class='docutils literal'><span class='pre'>Wand-mode-auto-fit</span></tt> - Boolean (default: <tt class='docutils literal'><span class='pre'>t</span></tt>)</p><p>When non-<tt class='docutils literal'><span class='pre'>nil</span></tt>, then scale image to fit it into SXEmacs window.</p></li>
<li><p class='first'><tt class='docutils literal'><span class='pre'>Wand-mode-auto-rotate</span></tt> - Boolean (default: <tt class='docutils literal'><span class='pre'>t</span></tt>)</p><p>When non-<tt class='docutils literal'><span class='pre'>nil</span></tt>, then rotate image in case it has orientation info inside (modern photo cameras can detect own space orientation and store this info inside photos). If rotation was done, then rotation operation will be placed into image operations stack. Very handy.</p></li>
</ul></div><div id='changing-image-and-saving' class='section'><h2>Changing image and saving</h2>
<p>Use next keys to operate on images:</p><ul class='simple'><li><tt class='docutils literal'><span class='pre'>l</span></tt> - Rotate by 90° counterclockwise (like to the left)</li>
<li><tt class='docutils literal'><span class='pre'>r</span></tt> - Rotate by 90° clockwise (like to the right)</li>
<li><tt class='docutils literal'><span class='pre'>+</span></tt> - Zoom in the image according to <tt class='docutils literal'><span class='pre'>Wand-mode-zoom-factor</span></tt></li>
<li><tt class='docutils literal'><span class='pre'>-</span></tt> - Zoom out the image according to <tt class='docutils literal'><span class='pre'>Wand-mode-zoom-factor</span></tt></li>
<li><tt class='docutils literal'><span class='pre'>o</span></tt> - General operational key. Inquiries for the operation to do and for its parameters. Supports completion.</li>
</ul><p>You can apply operations one by other, like we already did. All operations are stored in image operations stack, so you can undo/redo any using standard <tt class='docutils literal'><span class='pre'>C-/</span></tt> (or <tt class='docutils literal'><span class='pre'>C-_</span></tt>) and <tt class='docutils literal'><span class='pre'>C-x</span> <span class='pre'>C-/</span></tt> keys. Also you can re-apply last operation with <tt class='docutils literal'><span class='pre'>C-.</span></tt> (or <tt class='docutils literal'><span class='pre'>C-x</span> <span class='pre'>M-:</span></tt>) key. To abolish all operations just reload image with <tt class='docutils literal'><span class='pre'>C-r</span></tt>.</p><p>Now when new image is read, we can save it to the disk. There are two commands to do it:</p><div class='right width50 attention'><p class='first admonition-title'>Attention!</p>
<p class='last'><strong>ATTENTION</strong>: Saving to <em>non-graphical</em> formats such as <tt class='docutils literal'><span class='pre'>HTML</span></tt>, <tt class='docutils literal'><span class='pre'>TXT</span></tt>, etc, may lead to <tt class='docutils literal'><span class='pre'>core</span> <span class='pre'>dump</span></tt>. This is <a href='http://www.imagemagick.org/' class='reference external'>ImageMagick</a> bug, but unfortunately <a href='http://www.imagemagick.org/' class='reference external'>ImageMagick</a> developers not quite sociable guys, so only god knows when this will be fixed.</p></div><ul class='simple'><li><tt class='docutils literal'><span class='pre'>C-x</span> <span class='pre'>C-w</span></tt> - You'll be asked about file format to use and filename.</li>
<li><tt class='docutils literal'><span class='pre'>C-x</span> <span class='pre'>C-s</span></tt> - Simple way to save. You'll be queried for filename only. And file format will be automatically defined according to the extension of the filename you provided.</li>
</ul></div><div id='operating-on-image-region' class='section'><h2>Operating on image region</h2>
<div class='align-center' align='center'><img style='width: 500px; height: 260px;' src='http://lgarc.narod.ru/sxemacsen/img/wd-region-500.jpg' class='right margintop1 align-center' alt='Wand-display region'/></div>
<p>Using left mouse you can select image region, for example Sarah's hand. If <tt class='docutils literal'><span class='pre'>Wand-mode-show-fileinfo</span></tt> is set to non-<tt class='docutils literal'><span class='pre'>nil</span></tt>, then region's geometry (coordinates and size) will be displayed, sometimes this useful. When region is active then operations that can be applied to region, such as contrast, despeckle, etc will be applied to region only. There are few commands that are applicable <strong>only</strong> to regions:</p><ul class='simple'><li><tt class='docutils literal'><span class='pre'>c</span></tt> - crop the region and cut everything else</li>
<li><tt class='docutils literal'><span class='pre'>o</span> <span class='pre'>chop</span> <span class='pre'>RET</span></tt> - chop the region and assemble everything else together</li>
<li><a href='#red-eye-reduction' class='reference internal'>Red eye reduction</a></li>
</ul><p>After applying operation to region, region deactivates. To activate last region use <tt class='docutils literal'><span class='pre'>C-M-z</span></tt> command.</p></div><div id='red-eye-reduction' class='section'><h2>Red eye reduction</h2>
<p>Most important thing in the red eye reduction is correctly selected region. Best way to select region so all red part is in the centre of the region and there is a little free space from red part to the edges of the region. Here is an example of well formed region:</p><div class='align-center' align='center'><img style='width: 500px; height: 291px;' src='http://lgarc.narod.ru/sxemacsen/img/ra-good-500.jpg' class='align-center' alt='Wand-display red eye good region'/></div>
<p>And here is not so well selected region, however red eye reduction algorithm will handle it in this case, but in more complicated cases it might produce some artifacts:</p><div class='align-center' align='center'><img style='width: 500px; height: 291px;' src='http://lgarc.narod.ru/sxemacsen/img/ra-bad-500.jpg' class='align-center' alt='Wand-display red eye bad region'/></div>
<p>After selecting the region simple press <tt class='docutils literal'><span class='pre'>.</span></tt> or choose menu item <strong>Wand→Region→Remove red eye</strong>.</p><p>Red eye reduction algorithm used in <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt> is straightforward and can't compete with algorithms implemented in professional red eye reduction tools, however it demonstrates pretty good and usable results. Here is the comparison:</p><div class='align-center' align='center'><img style='width: 600px; height: 700px;' src='http://lgarc.narod.ru/sxemacsen/img/redeyes-sxemacs-vs-prof.jpg' class='align-center' alt='Wand-display red eyes sxemacs vs prof'/></div>
</div><div id='operations-table' class='section'><h2>Operations table</h2>
<p>To finalize the article, here is brief overview of operations you can do on images using <tt class='docutils literal'><span class='pre'>Wand-mode</span></tt>. Notice that operations which does not changes image size can be applied to region without problems:</p><table style='margin-left: auto; margin-right: auto'>
<tr id='transform'><td align='left' colspan='3'>
<span style='font-weight: bold; font-size: 120%; text-decoration: underline;'>Transform</span>
</td></tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Sample</span><br/>
Width: 400<br/>
Height: 200
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/transforms/sample.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Rotate</span><br/>
Degrees: 120°
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/transforms/rotate-120.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Flip</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/transforms/flip.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Flop</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/transforms/flop.jpg'/></td>
</tr>
<tr id='effects'><td align='left' colspan='3'>
<span style='font-weight: bold; font-size: 120%; text-decoration: underline;'>Effect</span>
</td></tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Add Noise</span><br/>
Noise type: Poisson
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/add-noise-poisson.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Despeckle</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/despeckle.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Edge detect</span><br/>
Radius: 1.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/edge-detect-1.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Emboss</span><br/>
Radius: 1.0<br/>Sigma: 2.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/emboss-1-2.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Gaussian Blur</span><br/>
Radius: 1.0<br/>Sigma: 2.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/gaussian-blur-1-2.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Radial Blur</span><br/>
Radius: 3.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/radial-blur-3.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Reduce Noise</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/reduce-noise.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Sharpen</span><br/>
Radius: 1.0<br/>Sigma: 2.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/sharpen-1-2.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Spread</span><br/>
Radius: 1.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/effects/spread-1.jpg'/></td>
</tr>
<tr id='enhance'><td align='left' colspan='3'>
<span style='font-weight: bold; font-size: 120%; text-decoration: underline;'>Enhance</span>
</td></tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Contrast</span><br/>
Type: increase</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/enhance/contrast-increase.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Contrast</span><br/>
Type: decrease</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/enhance/contrast-decrease.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Enhance</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/enhance/enhance.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Equalize</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/enhance/equalize.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Negate</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/enhance/negate.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'><span style='font-weight: bold'>Normalize</span></td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/enhance/normalize.jpg'/></td>
</tr>
<tr id='fx'><td align='left' colspan='3'>
<span style='font-weight: bold; font-size: 120%; text-decoration: underline;'>F/X</span>
</td></tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Charcoal</span><br/>
Radius: 1.0<br/>Sigma: 2.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/charcoal-1-2.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Implode</span><br/>
Radius: 0.4
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/implode-0.4.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Implode</span><br/>
Radius: -0.4
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/implode--0.4.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Oil Paint</span><br/>
Radius: 2.0
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/oil-paint-2.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Sepia Tone</span><br/>
Threshold: 85%
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/sepia-tone-85.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Solarize</span><br/>
Threshold: 50%
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/solarize-50.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Swirl</span><br/>
Angle: 90°
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/swirl-90.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Vignette</span><br/>
Black/White: 10
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/vignette-10.jpg'/></td>
</tr>
<tr>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/input.jpg'/></td>
<td align='center'>
<span style='font-weight: bold'>Wave</span><br/>
Amplitude: 2<br/>
Wave length: 10
</td>
<td><img src='http://lgarc.narod.ru/sxemacsen/img/fx/wave-2-10.jpg'/></td>
</tr>
</table></div>
</div>
lghttp://www.blogger.com/profile/08003803875490377611noreply@blogger.com0