Hot answers tagged

535

C# I put a random pixel in the middle, and then start putting random pixels in a neighborhood that most resembles them. Two modes are supported: with minimum selection, only one neighboring pixel is considered at a time; with average selection, all (1..8) are averaged. Minimum selection is somewhat noisy, average selection is of course more blurred, but ...


250

Processing Update! 4096x4096 images! I've merged my second post into this one by combining the two programs together. A full collection of selected images can be found here, on Dropbox. (Note: DropBox can't generate previews for the 4096x4096 images; just click them then click "Download"). If you only look at one look at this one (tileable)! Here it is ...


221

Python w/ PIL This is based on a Newtonian Fractal, specifically for z → z5 - 1. Because there are five roots, and thus five convergence points, the available color space is split into five regions, based on Hue. The individual points are sorted first by number of iterations required to reach their convergence point, and then by distance to that point, with ...


159

Java - GUI with progressive randomized transformation I tried a LOT of things, some of them very complicated, then I finally came back to this relatively-simple code: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; ...


131

I got this idea from user fejesjoco's algorithm and wanted to play a bit, so I started to write my own algorithm from scratch. I'm posting this because I feel that if I can make something better* than the best out of you guys, I don't think this challenge is finished yet. To compare, there are some stunning designs on allRGB that I consider way beyond the ...


118

Java import java.awt.Point; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Random; import javax.imageio.ImageIO;...


117

Minecraft Chat (vanilla 1.10 client, spigot 1.10 server): 19 bytes &4I &1V&4o&1t&4e&1d or from the clientside: §4I §1V§4o§1t§4e§1d Minecraft uses a color coding system with these colors programmed in. Mind the rules: Writing the text to a console using color formatting. In this case you may approximate pure red and blue ...


107

C, 82 80 78 74 54 bytes Thanks to @WillihamTotland and @criptych for saving 2 bytes each! f(){puts("␛[47;31mI␛[34m V␛[31mo␛[34mt␛[31me␛[34md");} Where the ␛s represent 0x1B bytes (escape key). As this code contains unprintable control characters, here is a reversible hexdump: 00000000: 6628 297b 7075 7473 2822 1b5b 3437 3b33 f(){puts(".[47;3 00000010: ...


97

Perl, with Lab color space and dithering Note: Now I have a C solution too. Uses a similar approach to aditsu's, (choose two random positions, and swap the pixels at those positions if it would make the image more like the target image), with two major improvements: Uses the CIE Lab* color space to compare colors — the Euclidean metric on this space is a ...


85

Minecraft 1.12 Redstone Command Blocks, 4,355 2,872 bytes (Size determined by saved structure block file size.) Here is a full YouTube overview, but I'll try to outline the code below. Setup Routine: This sets up the 40x40 grid of Minecraft armor stands. Armor stands are necessary because Minecraft has no way to substitute variables into world ...


79

Python The idea is simple: Every pixel has a point in the 3D RGB space. The goal is matching each a pixel of the source and one of the destination image, preferably they should be 'close' (represent the 'same' colour). Since they can be distributed in pretty different ways, we cannot just match the nearest neighbour. Strategy Let n be an integer (small, 3-...


73

Google Blockly, 10 14 blocks, 28 41 35 blytes Code Output Try it here Not counting the hide turtle block because it's just aesthetics. A blyte is a combination of a block and a byte, there's no meta post yet as how to count this, but I'll create one later. As for now, this is how I count: I o e, 8 blytes V t d, 10 blytes (2 leading spaces here) ...


72

C++ w/ Qt I see you version: using normal distribution for the colors: or first sorted by red / hue (with a smaller deviation): or some other distributions: Cauchy distribution (hsl / red): sorted cols by lightness (hsl): updated source code - produces 6th image: int main() { const int c = 256*128; std::vector<QRgb> data(c); QImage ...


64

In Java: import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.LinkedList; import javax.imageio.ImageIO; public class ImgColor { private static class Point { public int x, y; public color c; public Point(int x, int y, color c)...


48

Python - A theoretically optimal solution I say theoretically optimal because the truly optimal solution is not quite feasible to compute. I start off by describing the theoretical solution, and then explain how I tweaked it to make it computationally feasible in both space and time. I consider the most optimal solution as the one yielding the lowest total ...


48

HTML, 52 bytes I <c>V<e>o<c>t<e>e<c>d<style>*{color:red}c{color:0ff


45

Java with BubbleSort (usually Bubblesort isnt liked that much but for this challenge it finally had a use :) generated a line with all elements in 4096 steps apart then shuffled it; the sorting went thru and each like got 1 added to their value while being sorted so as result you got the values sorted and all colors Updated the Sourcecode to get those big ...


40

Java Variations of a color picker in 512x512. Elegant code it is not, but I do like the pretty pictures: import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Random; import javax.imageio.ImageIO; public class EighteenBitColors { static boolean shuffle_block = false; static int shuffle_radius = 0; ...


39

Python Edit: Just realized that you can actually sharpen the source with ImageFilter to make the results more well-defined. Rainbow -> Mona Lisa (sharpened Mona Lisa source, Luminance only) Rainbow -> Mona Lisa (non-sharpened source, weighted with Y = 10, I = 10, Q = 0) Mona Lisa -> American Gothic (non-sharpened source, Luminance only) Mona Lisa -> ...


39

C# Winform - Visual Studio 2010 Edit Dithering added. That's my version of random-swap algorithm - @hobbs flavour. I still feel that some sort of non-random dithering can do better... Color elaboration in Y-Cb-Cr space (as in jpeg compression) Two phase elaboration: Copy of pixel from source in luminance order. This already gives a good image, but ...


39

LaTeX, 147 126 bytes \documentclass{proc}\input color\begin{document}\def\z{\color{red}}\def\y{\color{blue}}\z I \y V\z o\y t\z e\y d\end{document} Saved 21 bytes and got better kerning thanks to @AndreïKostyrka. This prints an a4 page with this on the first line (note that this also prints page 1 on the bottom):


38

Processing I'm just getting started with C (having programmed in other languages) but found the graphics in Visual C tough to follow, so I downloaded this Processing program used by @ace. Here's my code and my algorithm. void setup(){ size(256,128); background(0); frameRate(1000000000); noLoop(); } int x,y,r,g,b,c; void draw() { for(y=0;y<...


35

C#: Iterative local similarity optimization using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.Drawing.Imaging; namespace AllColors { class Program { static Random _random = new Random(); const int ImageWidth = 256; const int ImageHeight = 128; ...


35

I just arranged all 16-bit colors (5r,6g,5b) on a Hilbert curve in JavaScript. Previous, (not Hilbert curve) image: JSfiddle: jsfiddle.net/LCsLQ/3 JavaScript // ported code from http://en.wikipedia.org/wiki/Hilbert_curve function xy2d (n, p) { p = {x: p.x, y: p.y}; var r = {x: 0, y: 0}, s, d=0; for (s=(n/2)|0; s>0; s=(s/2)|...


34

Windows 10 Batch, 51 50 bytes @color fc&echo I ␛[94mV␛[91mo␛[94mt␛[91me␛[94md␛[m Where ␛ represents the ANSI Escape 0x1B character. Outputs using colour formatting. Edit: Saved 1 byte thanks to @brianush1. I tried writing the code to generate this but it took 97 bytes. Output:


30

Java With a few variations on my other answer, we can get some very interesting outputs. import java.awt.Point; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Random; import java.util.logging.Level; import java.util....


29

Java I wasn't actually sure how to create 15- or 18-bit colors, so I just left off the least significant bit of each channel's byte to make 2^18 different 24-bit colors. Most of the noise is removed by sorting, but effective noise removal looks like it would require comparison of more than just two elements at a time the way Comparator does. I'll try ...


28

Scala I order all of the colors by walking a 3-dimensional Hilbert Curve via an L-System. I then walk the pixels in the output image along a 2-dimensional Hilbert Curve and lay out all of the colors. 512 x 512 output: Here's the code. Most of it covers just the logic and math of moving through three dimensions via pitch/roll/yaw. I'm sure there was a ...


28

C# Wow, really cool things in this challenge. I took a stab at this at in C# and generated a 4096x4096 image in about 3 minutes (i7 CPU) using every single color via Random Walk logic. Ok, so for the code. After being frustrated with hours of research and trying to generate every single HSL color using for loops in code, I settled for creating a flat file ...


Only top voted, non community-wiki answers of a minimum length are eligible