Most viewed recipes tagged "convert"http://code.activestate.com/recipes/tags/convert/views/2015-01-18T19:14:38-08:00ActiveState Code RecipesPython RGB and HSV Conversion (Python)
2009-10-01T06:33:56-07:00Michael Foglemanhttp://code.activestate.com/recipes/users/4171845/http://code.activestate.com/recipes/576919-python-rgb-and-hsv-conversion/
<p style="color: grey">
Python
recipe 576919
by <a href="/recipes/users/4171845/">Michael Fogleman</a>
(<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/hsv/">hsv</a>, <a href="/recipes/tags/rgb/">rgb</a>).
</p>
<p>Python code to convert RGB to HSV and vice-versa.</p>
Covert color space from HSV to RGB and RGB to HSV (Python)
2008-11-04T02:13:01-08:00Victor Linhttp://code.activestate.com/recipes/users/4167779/http://code.activestate.com/recipes/576554-covert-color-space-from-hsv-to-rgb-and-rgb-to-hsv/
<p style="color: grey">
Python
recipe 576554
by <a href="/recipes/users/4167779/">Victor Lin</a>
(<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/color_space/">color_space</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/graph/">graph</a>).
</p>
<p>Functions for converting bwtween RGB and HSV color space.</p>
Ascii Encryptor (Python)
2008-10-10T10:53:04-07:00Erik Andersonhttp://code.activestate.com/recipes/users/4155471/http://code.activestate.com/recipes/576535-ascii-encryptor/
<p style="color: grey">
Python
recipe 576535
by <a href="/recipes/users/4155471/">Erik Anderson</a>
(<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/encryption/">encryption</a>).
</p>
<p>Converts a string of characters to ascii</p>
Case insensitive filename on *nix systems - return the correct case filename (Python)
2008-11-25T16:27:13-08:00Campbell Bartonhttp://code.activestate.com/recipes/users/4168177/http://code.activestate.com/recipes/576571-case-insensitive-filename-on-nix-systems-return-th/
<p style="color: grey">
Python
recipe 576571
by <a href="/recipes/users/4168177/">Campbell Barton</a>
(<a href="/recipes/tags/case/">case</a>, <a href="/recipes/tags/case_insensitive/">case_insensitive</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/filename/">filename</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/sensitive/">sensitive</a>, <a href="/recipes/tags/windows/">windows</a>).
Revision 9.
</p>
<p>When dealing with windows paths on a *nix system sometimes youll need to resolve case insensitive paths. While using a fat filesystem or making everything lowercase would work.
this function means you can get python to take a case insensitive path and return the path with the correct case (if it exists).</p>
Convert Dictionary to XML (Python)
2009-10-28T10:39:44-07:00Adam M Prosthttp://code.activestate.com/recipes/users/4172124/http://code.activestate.com/recipes/576939-convert-dictionary-to-xml/
<p style="color: grey">
Python
recipe 576939
by <a href="/recipes/users/4172124/">Adam M Prost</a>
(<a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/simple/">simple</a>, <a href="/recipes/tags/xml/">xml</a>).
</p>
<p>A simple four line function for converting a dictionary into a simple xml string.</p>
Convert XML to Dictionary (Python)
2009-10-28T10:42:17-07:00Adam M Prosthttp://code.activestate.com/recipes/users/4172124/http://code.activestate.com/recipes/576940-convert-xml-to-dictionary/
<p style="color: grey">
Python
recipe 576940
by <a href="/recipes/users/4172124/">Adam M Prost</a>
(<a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/json/">json</a>, <a href="/recipes/tags/simple/">simple</a>, <a href="/recipes/tags/xml/">xml</a>).
Revision 2.
</p>
<p>A simple function to convert a headerless XML string into a dictionary using only simplejson and re.</p>
Image Converter (Python)
2015-01-18T19:14:38-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579007-image-converter/
<p style="color: grey">
Python
recipe 579007
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/conversions/">conversions</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/pil/">pil</a>).
</p>
<p>Converts an image from one format to another using PIL.</p>
Coordinates of numpy array from index and shape (Python)
2012-10-23T19:51:55-07:00Garretthttp://code.activestate.com/recipes/users/4181290/http://code.activestate.com/recipes/578302-coordinates-of-numpy-array-from-index-and-shape/
<p style="color: grey">
Python
recipe 578302
by <a href="/recipes/users/4181290/">Garrett</a>
(<a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/coordinates/">coordinates</a>, <a href="/recipes/tags/index/">index</a>, <a href="/recipes/tags/numpy/">numpy</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>returns the coordinates of a numpy array given the index and the shape. A first_index_et function is given as example code</p>
Convert Image Format (Python)
2011-09-30T10:46:21-07:00s_h_a_i_ohttp://code.activestate.com/recipes/users/4177334/http://code.activestate.com/recipes/577886-convert-image-format/
<p style="color: grey">
Python
recipe 577886
by <a href="/recipes/users/4177334/">s_h_a_i_o</a>
(<a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/format/">format</a>, <a href="/recipes/tags/image/">image</a>).
Revision 2.
</p>
<p>Simple GUI to allow converting images from one format to another. Available formats are: .gif .jpg .png .tif .bmp Uses PIL.</p>
<p>This is short and direct enhancement from recipe <a href="http://code.activestate.com/recipes/180801-convert-image-format" rel="nofollow">http://code.activestate.com/recipes/180801-convert-image-format</a>. Two new features added:</p>
<ul>
<li>Optional deletion of the original image files.</li>
<li>Optional recursive file selection. Implemented using <a href="http://code.activestate.com/recipes/577230-file-path-generator-from-path-patterns/" rel="nofollow">http://code.activestate.com/recipes/577230-file-path-generator-from-path-patterns/</a></li>
</ul>
<p><strong>note</strong> This assumes recipe/577230 is located in filePattern.py (see first import below)</p>
CSS line with px value adds a new line with rem (JavaScript)
2013-11-20T21:15:22-08:00Magnus Axelssonhttp://code.activestate.com/recipes/users/4188509/http://code.activestate.com/recipes/578769-css-line-with-px-value-adds-a-new-line-with-rem/
<p style="color: grey">
JavaScript
recipe 578769
by <a href="/recipes/users/4188509/">Magnus Axelsson</a>
(<a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/css/">css</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>Put your cursor on a CSS line that ends with a value in px (do not select any text). Run the script and it will insert a new line there the px value is converted to a rem value. </p>
<p>You need to edit the code to modify your rem base matching the one you use in your own CSS. The default value is 16.</p>
<p>Example:
font-size: 12px; (run the script with the cursor in this line)
font-size: 0.75rem (new line added by script) </p>