# Tag Info

149

///, 2*1 + 1020874 = 1020876 Prints a space.

123

Pyth (no built-in compression), score 4695.07 4656.03 4444.82 Pyth’s only image-related functionality is a builtin to write a matrix of RGB triples as an image file. So the crazy idea here is to train a small deep neural network on the (x, y) ↦ (r, g, b) function representing the image, and run it on the coordinates of each pixel. The plan Write a custom ...

120

Mathematica, score 14125.71333 "a.png"~Export~ConstantImage[{28,34,41}/95,{386,320}] Saves this image: to a.png.

110

Java, 7399.80678201 This reminded me of a project I had in my numerical computations class a few semesters back, which was to draw a silhouette of Mount Everest using polynomial interpolation. That was done in MATLAB, but I'm not very fond of MATLAB, so I decided to work in Java. The basic idea behind it is that I chose "smart" points (read here as ...

104

Perl, 2·70525 + 326508 = 467558 Predictor $m=($u=1<<32)-1;open B,B;@e=unpack"C*",join"",<B>;$e=2903392593;sub u{int($_+($_-$_)*pop)}sub o{$m&(pop()<<8)+pop}sub g{($h,%m,@b,$s,$E)=@_;if($d eq$h){($l,$u)=(u($l,$u,$L),u($l,$u,$U));$u=o(256,$u-1),$l=o($l),$e=o(shift@e,$e)until($l^($u-1))>>24}$M{"@c"}{$h}++-++$C{"@c"}-pop@c ... 101 Node.js, 2*224 + 524279 = 524727 Please refer to the change log at the end of this post for score updates. A function taking and returning a byte. a=[...l='14210100'],m={},s={},b={} f=c=>a.some((t,n)=>x=s[y=l.slice(n)]>t|/^[A-Z '"(]/.test(y)&&b[y],l+=String.fromCharCode(c),a.map((_,n)=>(m[x=l.slice(n)]=-~m[x])<s[y=l.slice(n,8)]||(s[... 93 Python3.4+, 4697.26 I used the same method as in my ImageMagick answer, but with the following parameters: convert ORIGINAL.png -filter Lanczos2 -resize x32 - | pngquant --speed 1 -f 20 > i Using these parameters I generated the following 1003 byte Python program (I didn't find any improvements over @kennytm's output method): import base64,io,PIL.Image ... 88 Python 3, score 5701.31 import base64,io,PIL.Image PIL.Image.open(io.BytesIO(base64.b85decode('iBL{Q4GJ0x0000DNk~Le0000I0000D2m$~A04pr1P5=MlSxEDRCrzu%wJF2MgRctyYrpz&VS-04oPU$02O1RYA2$KKm9YcYEUcDJyh+N==-F7oxW_3ecQvNY1*VQwC-UKjIkjQ8wn&8)Ukt&?VNpg?HBmL%~#(%>G5yhoON#6r~Pv6ekHzgk~o3d4gyuJLu_K5Ca>QWmKD%@0G*T5|2ap)6YJolVN{skh#D2-J*z9sSwJGT&-...

78

Python 3, 2·267 + 510193 = 510727 Predictor def p(): d={};s=b'' while 1: p={0:1};r=range(len(s)+1) for i in r: for c,n in d.setdefault(s[:i],{}).items():p[c]=p.get(c,1)*n**b'\1\6\f\36AcWuvY_v`\270~\333~'[i] c=yield max(sorted(p),key=p.get) for i in r:e=d[s[:i]];e[c]=e.get(c,1)+1 s=b'%c'%c+s[:15] This uses a weighted Bayesian combination of ...

72

Java, 8748.95 Another approach: I created a class that computes a Voronoi Diagram from a given set of points. This set of points is used as the parameter set that serves as the input for the Apache BOBYQAOptimizer. The evaluation function of the optimizer takes the points and creates a voronoi diagram from them. The voronoi regions are colored with the ...

55

Python 3, 2*279+592920=593478 2*250 + 592467 = 592967 2 * 271 + 592084 = 592626 2 * 278 + 592059 = 592615 2 * 285 + 586660 = 587230 2 * 320 + 585161 = 585801 2 * 339 + 585050 = 585728 d=m={} s=1 w,v='',0 def f(c): global w,m,v,s,d if w not in m:m[w]={} u=m[w];u[c]=c in u and 1+u[c]or 1;v+=1;q=n=' ';w=w*s+c;s=c!=n if w in m:_,n=max((m[w][k],k)for k in m[...

45

Windows BAT file, score 4458.854 echo QlBH+yAAgwKCQAADkkdARAHBcYMSAAABJgGvBVKInJKSe4D9mGo5+oRwrhSlmmqeYK22qun5kDzV+UZhRPdtXWSME8ABlNItkdoM5b0O7jO01KMnUbhSa4GAKq6U/AWBh8J4Od/O0RKwm2Bj1lAWi3yfWb9AB14B9/aml7juRU0fQTVS9LUQxE1eXTfp6f2SdBh9Ibyk3CNjdpEGdZLsuSPaQUP0vWnqtxyBsYQW1orBqzSh4zWFscTx5OMxA4FAw1/Y+/xx+TEUkogp4oykebVfCTFJYFRW6KZ+...

44

Python 2, 4749.88 1018 bytes Everybody has probably forgotten about this problem by now, except me.... This problem interested me far too much, especially as it quickly became apparent that approaches using image compression algorithms were definitely in the lead, but yet somehow unsatisfying from an aesthetic standpoint. Approaches based on optimizing a ...

41

ImageMagick, 4551.71 Uses the ImageMagick 'programming' language, using the following options (you might have to escape the !): convert i -resize 386x320! o.png Assuming the following 968 byte source file (given as hexdump): 00000000: 89 50 4E 47 0D 0A 1A 0A - 00 00 00 0D 49 48 44 52 | PNG IHDR| 00000010: 00 00 00 30 00 00 00 28 - 08 03 00 00 00 8F ...

41

C++11, 7441.68126105 6997.65434833 5198.16107651 More Updates I liked the ellipses from Perl so much I had to try them in C++11. I used the raw string to shove bytes into there, but for a while I was getting a slight discrepancy with the score I expected and the generated code. It turns out that you actually can't put a raw 0x0d (Carriage Return), since g++...

37

Matlab, score 5388.3 Without any built in compression. The colour depth is reduced such that each pixel can be represented by one printable character. And the resolution is reduced. This is then hardcoded as a string. The code itself reverses the whole process. The resizing operation is using a Lanczos 3 interpolation kernel. imwrite(imresize(reshape('@<...

30

zsh+bpgdec, 4159.061760861207 Yes, another BPG solution. I think this basically serves to prove that BPG is the best image compression utility currently available. Consider it an improvement over yallie's original BPG solution. The file is 1024 bytes long, right at the limit. It consists of the line exec bpgdec =(tail -n+2 \$0) followed by the raw BPG ...

27

Min: 12 bitsMax: Avg: Had and thought last night that I could possibly make it even smaller. x Colour to play next (0 -> Black, 1-> White) 1 Only King left? 00000 Position of White King (0 -> A1 ... 63 -> H8) 00000 Position of Black King 01 00000 11111 WK:A1, BK:H2 (Black to play) 11 00000 11111 WK:A1, BK:H2 (White to play) The result ...

27

Scala Sure, it'd be easier to encode MIDI files, but who's got a bunch of MIDI files lying around? It's not 1997! First things first: I've decided to interpret a "Unicode byte" as a "Unicode char" and use CJK characters, because: It matches the image challenge Twitter is cool with it I really need those bits There are a few tricks I use ...

27

C, 6641 999 bytes, using only stdio.h and math.h. I made a filled-circle function d() that draws concentric RGB colored circles over radius values r..0. 21 circles are used here. I could squeeze in a few more if I stripped out more whitespace, but I like the relative readability as it stands. I figured out rough circle placement using Gimp layers in ...

27

Python 2, 5238.59 points It is probably time to post my own answer. Here's the image The code looks like this import Image,ImageDraw as D m=Image.new("RGB",(386,320),"#4b5b6e") d=D.Draw(m,"RGBA") s="[string containing unprintable characters]" for i in range(95): x,y,w,h,r,g,b,a=[ord(c)-9for c in s[i::95]] ...

27

Starry, 11428.1894502 10904.3079277 10874.1307958 Starry might not be the best language to do this however it is certainly the most fitting. You can Try It online however it seems that the output is truncated so you will not get the full image. This program outputs an uncompressed ppm files to standard out. + +* +* +* +* . +. + +* +...

27

05AB1E, 4 bytes D1ìH Explanation D Duplicate input 1ì Prepend 1 H Interpret as hexadecimal and implicitly display the value in base 10 If the input has invalid hex characters, H won't push anything so the last value on the stack will be the duplicated input, that's why the program prints its input in case of invalid input. Try it online!

26

Haskell, 107 points import Control.Monad import Data.List type Elem = Char type Board = [[Elem]] type Constraints = ([Elem],[Elem],[Elem]) digits :: [Elem] digits = "123456789" noCons :: Constraints noCons = ([],[],[]) disjointCons :: Constraints disjointCons = ("123","456","789") -- constraints from a single block - ...

26

Python 3, score 5390.25, 998 bytes I used a simulated annealing program to fit rectangles into the shape of Starry Night. Then it uses a Gaussian blur to smooth out the straight rectangular edges. To save some bytes, I compressed the rectangle data into base 94. from PIL import Image as I,ImageDraw as D,ImageFilter as F def V(n,f,t): z=0;s='';d='''...

25

C++, score: 2*132 + 865821 = 866085 Thanks to @Quentin for saving 217 bytes! int f(int c){return c-10?"t \n 2 sS \n - 08........ huaoRooe oioaoheu thpih eEA \n neo enueee neue hteht e"[c-32]:10;} A very simple solution that, given a character, just outputs the character that most frequently appears after the input character. Verify the ...

25

FFmpeg -crf 0 -preset ultrafast -tune film -vf format=yuv444p, score 198.7425 Input is a 65535 × 1 PBM file: P4 65535 1 ...

22

192 bits (worst case) Here's a very simple storage scheme that should cope with arbitrary pawn promotions, and never requires more than 64 + 4 × 32 = 192 bits: The first 64 bits store a bitboard that tells where the pieces are (but not what they are). That is, we store one bit for each square of the chessboard (starting at square a1, then b1, c1, ...

22

Python, 2*516 + 521122 = 522154 Algorithm: Yet another python submission, this algorithm calculates the most likely next letter looking at sequences of length 1,...,l. The sum of probabilities is used, and there are a few tricks to get better results. from collections import Counter as C, defaultdict as D R,l=range,10 s,n='',[D(C) for _ in R(l+1)] def A(c)...

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