Popular recipes tagged "images"http://code.activestate.com/recipes/tags/images/2016-09-25T21:24:12-07:00ActiveState Code RecipesImage to ASCII Art Converter (Python) 2016-09-25T21:24:12-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/580702-image-to-ascii-art-converter/ <p style="color: grey"> Python recipe 580702 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/pil/">pil</a>). </p> <p>ASCII Art Generator (Image to ASCII Art Converter)</p> <p>Input file maybe JPG, PNG, GIF etc. Output file name maybe output.txt etc.</p> Image Projection Onto Sphere (Python) 2016-07-31T22:50:28-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/580695-image-projection-onto-sphere/ <p style="color: grey"> Python recipe 580695 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/image_processing/">image_processing</a>, <a href="/recipes/tags/imaging/">imaging</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/pil/">pil</a>). </p> <p>Image projection onto sphere using Equirectangular map projection.</p> <p>Download the test image from the Wikipedia page!</p> Image Resizer (Python) 2016-05-22T16:45:52-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/580663-image-resizer/ <p style="color: grey"> Python recipe 580663 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 2. </p> <p>Image resizer/converter command-line utility.</p> Random Planet Generator Using Plasma Fractal (Python) 2016-01-25T23:05:25-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/580495-random-planet-generator-using-plasma-fractal/ <p style="color: grey"> Python recipe 580495 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>). </p> <p>Random Planet Generator using 3D Plasma Fractal and Voxel-based Ray Tracing for rendering.</p> <p>Instead of generating 2D Plasma Fractal and projecting onto sphere, it generates 3D Plasma Fractal (cube) and cuts sphere from it.</p> Reaction Diffusion Simulation (Python) 2015-10-16T19:52:02-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579114-reaction-diffusion-simulation/ <p style="color: grey"> Python recipe 579114 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/physics/">physics</a>, <a href="/recipes/tags/simulation/">simulation</a>). Revision 2. </p> <p>Reaction-Diffusion Simulation using Gray-Scott Model.</p> Quasicrystal Pattern Generator (Python) 2015-08-08T20:50:23-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579094-quasicrystal-pattern-generator/ <p style="color: grey"> Python recipe 579094 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>). </p> <p>Quasicrystal Pattern Generator</p> 2D Discrete Fourier Transform (Python) 2015-01-03T03:39:34-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/578997-2d-discrete-fourier-transform/ <p style="color: grey"> Python recipe 578997 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/image_processing/">image_processing</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/signal_processing/">signal_processing</a>). </p> <p>2D Discrete Fourier Transform (DFT) and its inverse.</p> <p>Calculates 2D DFT of an image and recreates the image using inverse 2D DFT.</p> <p>Computation is slow so only suitable for thumbnail size images.</p> Draw Text To Image (Python) 2015-07-13T18:04:30-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579013-draw-text-to-image/ <p style="color: grey"> Python recipe 579013 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/pil/">pil</a>). Revision 2. </p> <p>PIL does not allow resizing default bitmap font. This code resizes it by itself.</p> <p>The disadvantage is slow speed but the advantage is it becomes possible to set color of each pixel of text foreground and background.</p> <p>As an example I set foreground to reverse colors and background to grayscale.</p> Mandelbrot Fractal image output to ppm file (Python) 2015-01-17T19:21:47-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579006-mandelbrot-fractal-image-output-to-ppm-file/ <p style="color: grey"> Python recipe 579006 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>). </p> <p>It creates image output without using any external library.</p> <p>PPM image files can be viewed and converted to other image file formats using many applications, GIMP or IrfanView for example.</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> Perlin Noise Generator (Python) 2013-02-23T05:23:24-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/578470-perlin-noise-generator/ <p style="color: grey"> Python recipe 578470 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/pil/">pil</a>). Revision 2. </p> <p>Perlin Noise Generator using Bilinear Interpolation.</p> CGI Image Viewer (Python) 2012-07-02T22:52:32-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578186-cgi-image-viewer/ <p style="color: grey"> Python recipe 578186 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/old/">old</a>). </p> <p>If you have ever started a program and never finished it, then you may recognize the code below for what it is: an experiment begun but not completed, meant to allow viewing pictures on a server. It is included here as an exercise for the reader to complete and is committed for archival to be run under Python 2.5 or later versions.</p> mouse click to crop many large photos quickly [Python, PIL, pygame] (Python) 2012-01-09T03:18:01-08:00Elliot Hallmarkhttp://code.activestate.com/recipes/users/4180468/http://code.activestate.com/recipes/578005-mouse-click-to-crop-many-large-photos-quickly-pyth/ <p style="color: grey"> Python recipe 578005 by <a href="/recipes/users/4180468/">Elliot Hallmark</a> (<a href="/recipes/tags/crop/">crop</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/jpeg/">jpeg</a>, <a href="/recipes/tags/mouse/">mouse</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/png/">png</a>). </p> <p>Waste no mouse clicks making multiple crops on many image files. Through pygame interface with pan, zoom and next/previous image. Saves files at new resolution and serialized names in a seperate folder. the mainloop() and helper functions are easy to reuse, but I include a cruddy text based interface if needed. if not, comment out most of __main__().</p> <p>Requires PIL (python imaging library) and pygame.</p> Comparing two images (Python) 2011-04-03T11:13:24-07:00Charlie Clarkhttp://code.activestate.com/recipes/users/4171013/http://code.activestate.com/recipes/577630-comparing-two-images/ <p style="color: grey"> Python recipe 577630 by <a href="/recipes/users/4171013/">Charlie Clark</a> (<a href="/recipes/tags/compare/">compare</a>, <a href="/recipes/tags/images/">images</a>). </p> <p>Compare two images using the root mean squared analysis. A result close to 0 means a good match.</p> Bitmap Maker (Python) 2011-04-21T13:08:46-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577674-bitmap-maker/ <p style="color: grey"> Python recipe 577674 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/experiment/">experiment</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/proof_of_concept/">proof_of_concept</a>, <a href="/recipes/tags/test/">test</a>). </p> <p>A friend and I were discussing the possibility of creating every possible image that is 800x600x24 (800 pixels wide by 600 pixels tall and using 24-bit color). This recipe is a proof-of-concept program showing what is possible with just a 2x2 image using 15 different colors (yielding a total of 50,625 images when run). In terms of the original thought experiment, a total of <code>16777216 ** 480000</code> images should be possible given the 800x600x24 specifications (or <code>1 &lt;&lt; 11520000</code> in binary). In base 10 that is <code>10 ** 3467865.55</code> and shows that there are an enormous number of possible states that a 800x600 canvas can take.</p> <p>If you have any comments or wish to down-vote this recipe, please provide your insight as to what could be improved upon and how you would go about fixing any problems that you might find.</p> Download all lolcat images from iCanHasCheezburger.com (Python) 2011-03-10T08:49:14-08:00Rahul Anandhttp://code.activestate.com/recipes/users/4173646/http://code.activestate.com/recipes/577603-download-all-lolcat-images-from-icanhascheezburger/ <p style="color: grey"> Python recipe 577603 by <a href="/recipes/users/4173646/">Rahul Anand</a> (<a href="/recipes/tags/download/">download</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/lolcat/">lolcat</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/web/">web</a>). </p> <p>Running this python script will download all lolcat images from <a href="http://icanhascheezburger.com" rel="nofollow">icanhascheezburger.com</a> to the current folder. Download will start from the oldest image. Images are collected into subfolders lolcat0, lolcat1 etc, each containing 300 images. The script can be stopped and resumed at anytime. Make sure to create files <em>lolconfig.txt</em> and <em>log.txt</em> in the same folder before running the script. <em>lolconfig.txt</em> must have a string as follows in the beginning: <em>1496/1496/0</em>. log.txt is an empty file in the beginning</p> Mass image resizing (with progress bar and details in console) (Python) 2010-04-13T07:06:09-07:00Rahul Anandhttp://code.activestate.com/recipes/users/4173646/http://code.activestate.com/recipes/577189-mass-image-resizing-with-progress-bar-and-details-/ <p style="color: grey"> Python recipe 577189 by <a href="/recipes/users/4173646/">Rahul Anand</a> (<a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/image_processing/">image_processing</a>, <a href="/recipes/tags/python/">python</a>). Revision 2. </p> <p>This script uses the Python Imaging libraries to resize images in a folder and its sub-folders iteratively. The details like the directory hierarchy, current progress etc are displayed dynamically. We can optionally specify more image formats, required size etc.(See command-line argument --help). This is meant for processing large collections of images, which justifies the display of many details.</p> PDF a Directory of Images using Reportlab (Python) 2009-04-12T08:35:10-07:00andrew.canithttp://code.activestate.com/recipes/users/4169843/http://code.activestate.com/recipes/576717-pdf-a-directory-of-images-using-reportlab/ <p style="color: grey"> Python recipe 576717 by <a href="/recipes/users/4169843/">andrew.canit</a> (<a href="/recipes/tags/directory/">directory</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/pdf/">pdf</a>). </p> <p>Walk through a directory PDFing Images</p>