Using the smallest number of bytes of code, write a program that produces this imageOutput a solid PNG from scratchGenerating PBM bitmap files from ASCII textCreate a chain of spam generators in as many languages as possiblePitch dark (Earth Hour remembrance)What is your star-sign?Animation of Code GolfDraw Sri YantraBinary Tetris in tweetsHide the Needle in the Haystack (Cops)Next number with k fives
How to cut a perfect shape out of 4cm oak?
Is it unusual that English uses possessive for past tense?
Did it take 3 minutes to reload a musket when the second amendment to the US constitution was ratified?
What is the white square near the viewfinder of the Fujica GW690?
Does any politician - honestly - want a No Deal Brexit?
I run daily 5kms but I cant seem to improve stamina when playing soccer
Can I exit and reenter a UK station while waiting for a connecting train?
Why it is a big deal whether or not Adam Schiff talked to the whistleblower?
when to use がつ or げつ readings for 月?
Why can a T* be passed in register, but a unique_ptr<T> cannot?
Most optimal hallways with random gravity inside?
Making a pikuach nefesh phone call on Yom Kippur - mitsva or something to be avoided?
I don't want my ls command in my script to print results on screen
Limit of sequence (by definiton)
Is there any research on the development of attacks against artificial intelligence systems?
Rules on "Pets on shoulder"
Is it really better for the environment if I take the stairs as opposed to a lift?
Cutting a 4.5m long 2x6 in half with a circular saw
Why were germanium diodes so fast and germanium transistors so slow?
Is the phrase “You are requested” polite or rude?
Did the US push the Kurds to lower their defences against Turkey in the months preceding the latest Turkish military operation against them?
Are my triangles similar?
What would a chair for a Human with a Tail look like?
I'm half of a hundred
Using the smallest number of bytes of code, write a program that produces this image
Output a solid PNG from scratchGenerating PBM bitmap files from ASCII textCreate a chain of spam generators in as many languages as possiblePitch dark (Earth Hour remembrance)What is your star-sign?Animation of Code GolfDraw Sri YantraBinary Tetris in tweetsHide the Needle in the Haystack (Cops)Next number with k fives
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
$begingroup$
Context:
Gynvael Coldwind, a famous security researcher, published a contest in his blog post (that is now complete). The goal was similar to the one described here, but with certain restrictions depending on which of the three allowed programming languages was chosen. I found the exercise fun and wanted to extend the challenge to all programming languages allowed.
Goal:
The goal of this golf is to write a program as short as possible that generates a PNG file which, after converting to bitmap shares the same resolution and pixel color values as the following image (alternate link, SHA256: ab18085a27c560ff03d479c3f32b289fb0a8d8ebb58c3f7081c0b9e1895213b6):
Rules:
- The program must work offline, i.e. when the language runtime/interpreter is installed, no internet connectivity is installed to build/run the program,
- The program may not rely on any external libraries (only use standard library of your language, as opposed to adding libraries from pip/npm/cargo/maven/whatever repositories),
- The program must complete its operation within 60 seconds on a regular desktop computer (i.e. no brute-forcing the results).
code-golf graphical-output
$endgroup$
|
show 9 more comments
$begingroup$
Context:
Gynvael Coldwind, a famous security researcher, published a contest in his blog post (that is now complete). The goal was similar to the one described here, but with certain restrictions depending on which of the three allowed programming languages was chosen. I found the exercise fun and wanted to extend the challenge to all programming languages allowed.
Goal:
The goal of this golf is to write a program as short as possible that generates a PNG file which, after converting to bitmap shares the same resolution and pixel color values as the following image (alternate link, SHA256: ab18085a27c560ff03d479c3f32b289fb0a8d8ebb58c3f7081c0b9e1895213b6):
Rules:
- The program must work offline, i.e. when the language runtime/interpreter is installed, no internet connectivity is installed to build/run the program,
- The program may not rely on any external libraries (only use standard library of your language, as opposed to adding libraries from pip/npm/cargo/maven/whatever repositories),
- The program must complete its operation within 60 seconds on a regular desktop computer (i.e. no brute-forcing the results).
code-golf graphical-output
$endgroup$
4
$begingroup$
What do you mean by "external libraries?"
$endgroup$
– Esolanging Fruit
May 26 at 7:36
3
$begingroup$
These always end up being full of long strings being base64decoded. Can you tell us more about the image, to help facilitate other approaches?
$endgroup$
– Aaron F
May 26 at 10:33
10
$begingroup$
The secondary task of golfing a PNG encoder seems like it might overshadow the main thrust of the challenge.
$endgroup$
– gastropner
May 26 at 11:15
5
$begingroup$
@d33tah I believe this still fits the Cumbersome IO formats thing from "Things to avoid when writing challenges" extremely well. In particular, a PNG file has CRC checksums that have to be calculated.
$endgroup$
– someone
May 26 at 12:12
5
$begingroup$
Someone want to do this in Piet?
$endgroup$
– msh210
May 26 at 13:42
|
show 9 more comments
$begingroup$
Context:
Gynvael Coldwind, a famous security researcher, published a contest in his blog post (that is now complete). The goal was similar to the one described here, but with certain restrictions depending on which of the three allowed programming languages was chosen. I found the exercise fun and wanted to extend the challenge to all programming languages allowed.
Goal:
The goal of this golf is to write a program as short as possible that generates a PNG file which, after converting to bitmap shares the same resolution and pixel color values as the following image (alternate link, SHA256: ab18085a27c560ff03d479c3f32b289fb0a8d8ebb58c3f7081c0b9e1895213b6):
Rules:
- The program must work offline, i.e. when the language runtime/interpreter is installed, no internet connectivity is installed to build/run the program,
- The program may not rely on any external libraries (only use standard library of your language, as opposed to adding libraries from pip/npm/cargo/maven/whatever repositories),
- The program must complete its operation within 60 seconds on a regular desktop computer (i.e. no brute-forcing the results).
code-golf graphical-output
$endgroup$
Context:
Gynvael Coldwind, a famous security researcher, published a contest in his blog post (that is now complete). The goal was similar to the one described here, but with certain restrictions depending on which of the three allowed programming languages was chosen. I found the exercise fun and wanted to extend the challenge to all programming languages allowed.
Goal:
The goal of this golf is to write a program as short as possible that generates a PNG file which, after converting to bitmap shares the same resolution and pixel color values as the following image (alternate link, SHA256: ab18085a27c560ff03d479c3f32b289fb0a8d8ebb58c3f7081c0b9e1895213b6):
Rules:
- The program must work offline, i.e. when the language runtime/interpreter is installed, no internet connectivity is installed to build/run the program,
- The program may not rely on any external libraries (only use standard library of your language, as opposed to adding libraries from pip/npm/cargo/maven/whatever repositories),
- The program must complete its operation within 60 seconds on a regular desktop computer (i.e. no brute-forcing the results).
code-golf graphical-output
code-golf graphical-output
edited May 26 at 11:42
Arnauld
94.8k7 gold badges111 silver badges384 bronze badges
94.8k7 gold badges111 silver badges384 bronze badges
asked May 26 at 7:12
d33tahd33tah
2371 silver badge8 bronze badges
2371 silver badge8 bronze badges
4
$begingroup$
What do you mean by "external libraries?"
$endgroup$
– Esolanging Fruit
May 26 at 7:36
3
$begingroup$
These always end up being full of long strings being base64decoded. Can you tell us more about the image, to help facilitate other approaches?
$endgroup$
– Aaron F
May 26 at 10:33
10
$begingroup$
The secondary task of golfing a PNG encoder seems like it might overshadow the main thrust of the challenge.
$endgroup$
– gastropner
May 26 at 11:15
5
$begingroup$
@d33tah I believe this still fits the Cumbersome IO formats thing from "Things to avoid when writing challenges" extremely well. In particular, a PNG file has CRC checksums that have to be calculated.
$endgroup$
– someone
May 26 at 12:12
5
$begingroup$
Someone want to do this in Piet?
$endgroup$
– msh210
May 26 at 13:42
|
show 9 more comments
4
$begingroup$
What do you mean by "external libraries?"
$endgroup$
– Esolanging Fruit
May 26 at 7:36
3
$begingroup$
These always end up being full of long strings being base64decoded. Can you tell us more about the image, to help facilitate other approaches?
$endgroup$
– Aaron F
May 26 at 10:33
10
$begingroup$
The secondary task of golfing a PNG encoder seems like it might overshadow the main thrust of the challenge.
$endgroup$
– gastropner
May 26 at 11:15
5
$begingroup$
@d33tah I believe this still fits the Cumbersome IO formats thing from "Things to avoid when writing challenges" extremely well. In particular, a PNG file has CRC checksums that have to be calculated.
$endgroup$
– someone
May 26 at 12:12
5
$begingroup$
Someone want to do this in Piet?
$endgroup$
– msh210
May 26 at 13:42
4
4
$begingroup$
What do you mean by "external libraries?"
$endgroup$
– Esolanging Fruit
May 26 at 7:36
$begingroup$
What do you mean by "external libraries?"
$endgroup$
– Esolanging Fruit
May 26 at 7:36
3
3
$begingroup$
These always end up being full of long strings being base64decoded. Can you tell us more about the image, to help facilitate other approaches?
$endgroup$
– Aaron F
May 26 at 10:33
$begingroup$
These always end up being full of long strings being base64decoded. Can you tell us more about the image, to help facilitate other approaches?
$endgroup$
– Aaron F
May 26 at 10:33
10
10
$begingroup$
The secondary task of golfing a PNG encoder seems like it might overshadow the main thrust of the challenge.
$endgroup$
– gastropner
May 26 at 11:15
$begingroup$
The secondary task of golfing a PNG encoder seems like it might overshadow the main thrust of the challenge.
$endgroup$
– gastropner
May 26 at 11:15
5
5
$begingroup$
@d33tah I believe this still fits the Cumbersome IO formats thing from "Things to avoid when writing challenges" extremely well. In particular, a PNG file has CRC checksums that have to be calculated.
$endgroup$
– someone
May 26 at 12:12
$begingroup$
@d33tah I believe this still fits the Cumbersome IO formats thing from "Things to avoid when writing challenges" extremely well. In particular, a PNG file has CRC checksums that have to be calculated.
$endgroup$
– someone
May 26 at 12:12
5
5
$begingroup$
Someone want to do this in Piet?
$endgroup$
– msh210
May 26 at 13:42
$begingroup$
Someone want to do this in Piet?
$endgroup$
– msh210
May 26 at 13:42
|
show 9 more comments
5 Answers
5
active
oldest
votes
$begingroup$
C#, 849 793 771 bytes
using System;using System.Drawing;using System.IO;class Pstatic void Main()dynamic x,y,i=new Bitmap(Bitmap.FromStream(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"),0,312))),d=new Bitmap(1920,1080),g=Graphics.FromImage(d);for(y=0;y<54;y++)for(x=0;x<96;x++)g.FillRectangle(new SolidBrush(i.GetPixel(x,y)),new Rectangle(x*20,y*20,20,20));d.Save("s.png");
Tested with the following code:
class P
static void Main()
Bitmap a = new Bitmap(@"c:projectsconfidence_2019_golf.png");
Bitmap b = new Bitmap(@"c:projectss.png");
Console.WriteLine(a.Width + ", " + b.Width);
Console.WriteLine(a.Height + ", " + b.Height);
for (int y=0; y<a.Height; y++)
for (int x=0; x<a.Width; x++)
ca.G != cb.G
Ungolfed:
using System;
using System.Drawing;
using System.IO;
class P
static void Main()
dynamic x = 0;
dynamic y = 0;
dynamic b = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC");
dynamic i = new Bitmap(Bitmap.FromStream(new MemoryStream(b, 0, 312)));
dynamic d = new Bitmap(1920, 1080);
dynamic g = Graphics.FromImage(d);
for (y = 0; y < 54; y++)
for (x = 0; x < 96; x++)
g.FillRectangle(new SolidBrush(i.GetPixel(x, y)), new Rectangle(x * 20, y * 20, 20, 20));
d.Save(@"c:projectss.png");
$endgroup$
2
$begingroup$
iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC
should work for the image as well; produced with zopflipng, assuming I did everything right.
$endgroup$
– someone
May 26 at 10:26
$begingroup$
Cool! Thanks @someone
$endgroup$
– Johan du Toit
May 26 at 10:38
$begingroup$
You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.
$endgroup$
– someone
May 26 at 10:41
1
$begingroup$
You do not have to set y and x to 0 in thefor
loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in theSystem.Drawing
namespace (automatically usingSystem
if my brain works right) and referring to MemoryStream directly.
$endgroup$
– someone
May 26 at 11:00
$begingroup$
Thanks, I'm moving on to a javascript based solution. C# is just too verbose...
$endgroup$
– Johan du Toit
May 26 at 11:13
|
show 5 more comments
$begingroup$
HTML + Javascript, 607 591 527 bytes
Thank you Epicness and Someone.
HTML, 436 bytes
<img id=a src=data:;base64,UklGRgABAABXRUJQVlA4TPMAAAAvX0ANALXIcSTJkST68N2Xs2p6ZJgUYgEpOVBwcYtMwGKJpBDAL5EUqioEEAAFTf8n4Akeel/aoYdx8E3jdbec+Bj0CQIKAqIiKqjd3hEU1L/CRATRBWhApHdtTIzZysYT0r794RjJEja6QbvdpUT9W1xDMYkxMQYEjWM4HPkrhiZRGjZoojYx0THU87bTZpWN2U6bJGMxF1qbRQ69BMYY48POObP4kX5/5753WXNeKm2SAFRBVRKqWK2CKkjmvG1VVbHY7K+aM7lk5mS1qqlaq2raKuh/9u1jI0BVVQNzzmJ3VRVcNluTcPxlBPR/7f3rMRIA><a id=b download>SAVE<canvas id=c width=1920 height=1080
Javascript, 91 bytes
b.href=c.toDataURL((d=c.getContext`2d`).drawImage(a,d.imageSmoothingEnabled=0,0,1920,1080))
JSFiddle
$endgroup$
$begingroup$
How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle
$endgroup$
– someone
May 27 at 12:16
$begingroup$
Thanks, I'm not sure what happened.
$endgroup$
– Johan du Toit
May 27 at 12:29
1
$begingroup$
Are you sure you want the "SAVE" link at all? I think you can simply alertc.toDataUrl()
.
$endgroup$
– someone
May 27 at 13:50
$begingroup$
Yes, I was not sure about that.alert
does not show all the content, perhapsconsole.log
?
$endgroup$
– Johan du Toit
May 27 at 14:06
1
$begingroup$
@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them tozopflipng
and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at s000.tinyupload.com/index.php?file_id=18210440611599235182 .
$endgroup$
– someone
May 28 at 13:22
|
show 14 more comments
$begingroup$
C# (Visual C# Interactive Compiler), 707 bytes
#r"System.Drawing"
using System.Drawing.Drawing2D;dynamic a=new Bitmap(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"))),b=new Bitmap(1920, 1080),c=Graphics.FromImage(b);c.InterpolationMode=(InterpolationMode)5;c.PixelOffsetMode=(PixelOffsetMode)4;c.DrawImage(a,0,0,1920,1080);b.Save("b.png");
Only compiles in the interactive window, saves the result in a file called b.png
$endgroup$
add a comment
|
$begingroup$
C (GCC/MinGW), 1439 1406 1386 1382 1092 807 806 800 789 787 786 777 bytes
-33 -4 -11 -9 bytes thanks to ceilingcat
-6 bytes thanks to someone's idea
Edit: Why even dynamically calculate CRCs when the output is static? Dropping that part really slimmed things down.
Somewhat beefier than other entries, but such is C life.
Assumes sizeof(unsigned int) == 4
, i.e. 32-bit integers, and little-endianness.
The earlier RLE scheme is replaced by a slightly more complex one. Most of the image (except the "CONFIDENCE" text) is stored as a series of rectangles. Each rectangle is stored as four characters holding (x1, y1) and (x2 + 1, y2 + 1). We start with the lowest colour in the palette and upon hitting a space character in the image data, we increase the palette index.
I have a feeling further compression could be had by storing colours slightly differently and exploiting the additive nature of the colours of overlapping areas.
The "CONFIDENCE" text is stored as a series of characters holding 6 significant bits, each one of which corresponds to a "pixel" in the text.
#define Y*Q++-31
*o,C,x,i,W=5760,H=1080,Z[]=262749,394124,459939,8487086,8552901,8618449,~0;S(b,D,C,B,A,c)char*b;for(B*=20;B<D*20;B++)for(x=A*20;x<C*20;)bcopy(Z+c,b+B*W+x++*3,3);(*X)()=fwrite;main(j)char*p=calloc(W,H),d[]="x8126~xe9",*Q="&&<57)V;22?E;9LOI3eI[%o7_1yA 7)<;2275;2?EC9I;I3V;I;LI[3_7_1o7_7eA 72<5;9?;_3e7 C;E?G;I?M;O?W;Y?[;]?GAIEMAOEWAYEaAcE??CA?ECG]EaG]9_;]?_ALEMG ?9C;L9M;_9a;_?aAa;c?=A?EIELG I9L;";for(;*Q;)S(p,Y,Y,Y,Y,C+=*Q<33&&Y);for(X("x89PNGrn32nrIHDRax8048b2gxb1V24_5VIDATb35",1,43,o=fopen("a.png","wb"));i<240;i++)"FStuybLGitTTJfRAaTuUzjBGiTVTJrRAFSTtybLG"[i/6]-64>>i%6&1&&S(p,C+1,j+1,C=17+i/48,j=26+i/6%8*6+i%6,6);for(;H--;p+=X(p,1,W,o))*d=!H,X(d,1,6,o);X("*vC6xc7xe320WIEND256B`x82",1,20,o);
$endgroup$
$begingroup$
this segfaults on my machine.
$endgroup$
– don bright
May 27 at 19:12
1
$begingroup$
@donbright some compilers/runtimes require#include<stdio.h>
to avoid segfaulting.
$endgroup$
– ceilingcat
May 27 at 19:32
$begingroup$
is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?
$endgroup$
– don bright
May 27 at 19:38
1
$begingroup$
oh i see, "standard libraries" is acceptable. upvoted!
$endgroup$
– don bright
May 27 at 19:49
$begingroup$
Is 16777215-1u>>8
? That should save two bytes.
$endgroup$
– someone
Jun 1 at 12:28
|
show 3 more comments
$begingroup$
HTML + javascript, 504 bytes - Not competing
I still need to get the colors sorted out.
HTML, 35 bytes
<canvas id=g width=1920 height=1080
Javascript, 469 bytes
d=g.getContext`2d`
d[f='fillRect'](0,0,1920,1080)
d[a='globalAlpha']=.4
d[l='fillStyle']=`#a00`
'//>7|@2G:|;;5;|DB9>|R<D>|d.<:|h:B8'.split`|`.map(x=>x.split``.map(c=>(c[w='charCodeAt']()-40)*20)).map(x=>d[f](...x))
d[l]='#fff'
d[a]=1
q=(h,x,y,p,z)=>b=atob(h).split``;for(var n in b)0)*z,z,z);
q('xkTXucgcKU1RiikFIVVXuiocKWVRiiwFxkTRucgc',520,340,6,20)
d[a]=.4
q('xgADKKEEKKEEBgADISEEISEExgAD',600,520,3,40)
JSFiddle
$endgroup$
$begingroup$
I believe you can replace the...,y+((n/p)|0)*z...
bit with...,y+~~(n/p)*z
, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.
$endgroup$
– someone
May 28 at 14:28
$begingroup$
Without the|0
it calculates a floating point value that blurs the image.
$endgroup$
– Johan du Toit
May 28 at 14:57
$begingroup$
Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggestgpick
for Linux orColorPix
for Windows.
$endgroup$
– someone
May 28 at 15:04
$begingroup$
I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.
$endgroup$
– Johan du Toit
May 28 at 15:15
$begingroup$
See Diff results for Chrome vs Firefox
$endgroup$
– Johan du Toit
May 29 at 14:38
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f186120%2fusing-the-smallest-number-of-bytes-of-code-write-a-program-that-produces-this-i%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
C#, 849 793 771 bytes
using System;using System.Drawing;using System.IO;class Pstatic void Main()dynamic x,y,i=new Bitmap(Bitmap.FromStream(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"),0,312))),d=new Bitmap(1920,1080),g=Graphics.FromImage(d);for(y=0;y<54;y++)for(x=0;x<96;x++)g.FillRectangle(new SolidBrush(i.GetPixel(x,y)),new Rectangle(x*20,y*20,20,20));d.Save("s.png");
Tested with the following code:
class P
static void Main()
Bitmap a = new Bitmap(@"c:projectsconfidence_2019_golf.png");
Bitmap b = new Bitmap(@"c:projectss.png");
Console.WriteLine(a.Width + ", " + b.Width);
Console.WriteLine(a.Height + ", " + b.Height);
for (int y=0; y<a.Height; y++)
for (int x=0; x<a.Width; x++)
ca.G != cb.G
Ungolfed:
using System;
using System.Drawing;
using System.IO;
class P
static void Main()
dynamic x = 0;
dynamic y = 0;
dynamic b = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC");
dynamic i = new Bitmap(Bitmap.FromStream(new MemoryStream(b, 0, 312)));
dynamic d = new Bitmap(1920, 1080);
dynamic g = Graphics.FromImage(d);
for (y = 0; y < 54; y++)
for (x = 0; x < 96; x++)
g.FillRectangle(new SolidBrush(i.GetPixel(x, y)), new Rectangle(x * 20, y * 20, 20, 20));
d.Save(@"c:projectss.png");
$endgroup$
2
$begingroup$
iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC
should work for the image as well; produced with zopflipng, assuming I did everything right.
$endgroup$
– someone
May 26 at 10:26
$begingroup$
Cool! Thanks @someone
$endgroup$
– Johan du Toit
May 26 at 10:38
$begingroup$
You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.
$endgroup$
– someone
May 26 at 10:41
1
$begingroup$
You do not have to set y and x to 0 in thefor
loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in theSystem.Drawing
namespace (automatically usingSystem
if my brain works right) and referring to MemoryStream directly.
$endgroup$
– someone
May 26 at 11:00
$begingroup$
Thanks, I'm moving on to a javascript based solution. C# is just too verbose...
$endgroup$
– Johan du Toit
May 26 at 11:13
|
show 5 more comments
$begingroup$
C#, 849 793 771 bytes
using System;using System.Drawing;using System.IO;class Pstatic void Main()dynamic x,y,i=new Bitmap(Bitmap.FromStream(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"),0,312))),d=new Bitmap(1920,1080),g=Graphics.FromImage(d);for(y=0;y<54;y++)for(x=0;x<96;x++)g.FillRectangle(new SolidBrush(i.GetPixel(x,y)),new Rectangle(x*20,y*20,20,20));d.Save("s.png");
Tested with the following code:
class P
static void Main()
Bitmap a = new Bitmap(@"c:projectsconfidence_2019_golf.png");
Bitmap b = new Bitmap(@"c:projectss.png");
Console.WriteLine(a.Width + ", " + b.Width);
Console.WriteLine(a.Height + ", " + b.Height);
for (int y=0; y<a.Height; y++)
for (int x=0; x<a.Width; x++)
ca.G != cb.G
Ungolfed:
using System;
using System.Drawing;
using System.IO;
class P
static void Main()
dynamic x = 0;
dynamic y = 0;
dynamic b = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC");
dynamic i = new Bitmap(Bitmap.FromStream(new MemoryStream(b, 0, 312)));
dynamic d = new Bitmap(1920, 1080);
dynamic g = Graphics.FromImage(d);
for (y = 0; y < 54; y++)
for (x = 0; x < 96; x++)
g.FillRectangle(new SolidBrush(i.GetPixel(x, y)), new Rectangle(x * 20, y * 20, 20, 20));
d.Save(@"c:projectss.png");
$endgroup$
2
$begingroup$
iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC
should work for the image as well; produced with zopflipng, assuming I did everything right.
$endgroup$
– someone
May 26 at 10:26
$begingroup$
Cool! Thanks @someone
$endgroup$
– Johan du Toit
May 26 at 10:38
$begingroup$
You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.
$endgroup$
– someone
May 26 at 10:41
1
$begingroup$
You do not have to set y and x to 0 in thefor
loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in theSystem.Drawing
namespace (automatically usingSystem
if my brain works right) and referring to MemoryStream directly.
$endgroup$
– someone
May 26 at 11:00
$begingroup$
Thanks, I'm moving on to a javascript based solution. C# is just too verbose...
$endgroup$
– Johan du Toit
May 26 at 11:13
|
show 5 more comments
$begingroup$
C#, 849 793 771 bytes
using System;using System.Drawing;using System.IO;class Pstatic void Main()dynamic x,y,i=new Bitmap(Bitmap.FromStream(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"),0,312))),d=new Bitmap(1920,1080),g=Graphics.FromImage(d);for(y=0;y<54;y++)for(x=0;x<96;x++)g.FillRectangle(new SolidBrush(i.GetPixel(x,y)),new Rectangle(x*20,y*20,20,20));d.Save("s.png");
Tested with the following code:
class P
static void Main()
Bitmap a = new Bitmap(@"c:projectsconfidence_2019_golf.png");
Bitmap b = new Bitmap(@"c:projectss.png");
Console.WriteLine(a.Width + ", " + b.Width);
Console.WriteLine(a.Height + ", " + b.Height);
for (int y=0; y<a.Height; y++)
for (int x=0; x<a.Width; x++)
ca.G != cb.G
Ungolfed:
using System;
using System.Drawing;
using System.IO;
class P
static void Main()
dynamic x = 0;
dynamic y = 0;
dynamic b = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC");
dynamic i = new Bitmap(Bitmap.FromStream(new MemoryStream(b, 0, 312)));
dynamic d = new Bitmap(1920, 1080);
dynamic g = Graphics.FromImage(d);
for (y = 0; y < 54; y++)
for (x = 0; x < 96; x++)
g.FillRectangle(new SolidBrush(i.GetPixel(x, y)), new Rectangle(x * 20, y * 20, 20, 20));
d.Save(@"c:projectss.png");
$endgroup$
C#, 849 793 771 bytes
using System;using System.Drawing;using System.IO;class Pstatic void Main()dynamic x,y,i=new Bitmap(Bitmap.FromStream(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"),0,312))),d=new Bitmap(1920,1080),g=Graphics.FromImage(d);for(y=0;y<54;y++)for(x=0;x<96;x++)g.FillRectangle(new SolidBrush(i.GetPixel(x,y)),new Rectangle(x*20,y*20,20,20));d.Save("s.png");
Tested with the following code:
class P
static void Main()
Bitmap a = new Bitmap(@"c:projectsconfidence_2019_golf.png");
Bitmap b = new Bitmap(@"c:projectss.png");
Console.WriteLine(a.Width + ", " + b.Width);
Console.WriteLine(a.Height + ", " + b.Height);
for (int y=0; y<a.Height; y++)
for (int x=0; x<a.Width; x++)
ca.G != cb.G
Ungolfed:
using System;
using System.Drawing;
using System.IO;
class P
static void Main()
dynamic x = 0;
dynamic y = 0;
dynamic b = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC");
dynamic i = new Bitmap(Bitmap.FromStream(new MemoryStream(b, 0, 312)));
dynamic d = new Bitmap(1920, 1080);
dynamic g = Graphics.FromImage(d);
for (y = 0; y < 54; y++)
for (x = 0; x < 96; x++)
g.FillRectangle(new SolidBrush(i.GetPixel(x, y)), new Rectangle(x * 20, y * 20, 20, 20));
d.Save(@"c:projectss.png");
edited May 26 at 13:11
answered May 26 at 8:47
Johan du ToitJohan du Toit
1,5045 silver badges11 bronze badges
1,5045 silver badges11 bronze badges
2
$begingroup$
iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC
should work for the image as well; produced with zopflipng, assuming I did everything right.
$endgroup$
– someone
May 26 at 10:26
$begingroup$
Cool! Thanks @someone
$endgroup$
– Johan du Toit
May 26 at 10:38
$begingroup$
You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.
$endgroup$
– someone
May 26 at 10:41
1
$begingroup$
You do not have to set y and x to 0 in thefor
loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in theSystem.Drawing
namespace (automatically usingSystem
if my brain works right) and referring to MemoryStream directly.
$endgroup$
– someone
May 26 at 11:00
$begingroup$
Thanks, I'm moving on to a javascript based solution. C# is just too verbose...
$endgroup$
– Johan du Toit
May 26 at 11:13
|
show 5 more comments
2
$begingroup$
iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC
should work for the image as well; produced with zopflipng, assuming I did everything right.
$endgroup$
– someone
May 26 at 10:26
$begingroup$
Cool! Thanks @someone
$endgroup$
– Johan du Toit
May 26 at 10:38
$begingroup$
You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.
$endgroup$
– someone
May 26 at 10:41
1
$begingroup$
You do not have to set y and x to 0 in thefor
loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in theSystem.Drawing
namespace (automatically usingSystem
if my brain works right) and referring to MemoryStream directly.
$endgroup$
– someone
May 26 at 11:00
$begingroup$
Thanks, I'm moving on to a javascript based solution. C# is just too verbose...
$endgroup$
– Johan du Toit
May 26 at 11:13
2
2
$begingroup$
iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC
should work for the image as well; produced with zopflipng, assuming I did everything right.$endgroup$
– someone
May 26 at 10:26
$begingroup$
iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC
should work for the image as well; produced with zopflipng, assuming I did everything right.$endgroup$
– someone
May 26 at 10:26
$begingroup$
Cool! Thanks @someone
$endgroup$
– Johan du Toit
May 26 at 10:38
$begingroup$
Cool! Thanks @someone
$endgroup$
– Johan du Toit
May 26 at 10:38
$begingroup$
You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.
$endgroup$
– someone
May 26 at 10:41
$begingroup$
You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.
$endgroup$
– someone
May 26 at 10:41
1
1
$begingroup$
You do not have to set y and x to 0 in the
for
loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in the System.Drawing
namespace (automatically using System
if my brain works right) and referring to MemoryStream directly.$endgroup$
– someone
May 26 at 11:00
$begingroup$
You do not have to set y and x to 0 in the
for
loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in the System.Drawing
namespace (automatically using System
if my brain works right) and referring to MemoryStream directly.$endgroup$
– someone
May 26 at 11:00
$begingroup$
Thanks, I'm moving on to a javascript based solution. C# is just too verbose...
$endgroup$
– Johan du Toit
May 26 at 11:13
$begingroup$
Thanks, I'm moving on to a javascript based solution. C# is just too verbose...
$endgroup$
– Johan du Toit
May 26 at 11:13
|
show 5 more comments
$begingroup$
HTML + Javascript, 607 591 527 bytes
Thank you Epicness and Someone.
HTML, 436 bytes
<img id=a src=data:;base64,UklGRgABAABXRUJQVlA4TPMAAAAvX0ANALXIcSTJkST68N2Xs2p6ZJgUYgEpOVBwcYtMwGKJpBDAL5EUqioEEAAFTf8n4Akeel/aoYdx8E3jdbec+Bj0CQIKAqIiKqjd3hEU1L/CRATRBWhApHdtTIzZysYT0r794RjJEja6QbvdpUT9W1xDMYkxMQYEjWM4HPkrhiZRGjZoojYx0THU87bTZpWN2U6bJGMxF1qbRQ69BMYY48POObP4kX5/5753WXNeKm2SAFRBVRKqWK2CKkjmvG1VVbHY7K+aM7lk5mS1qqlaq2raKuh/9u1jI0BVVQNzzmJ3VRVcNluTcPxlBPR/7f3rMRIA><a id=b download>SAVE<canvas id=c width=1920 height=1080
Javascript, 91 bytes
b.href=c.toDataURL((d=c.getContext`2d`).drawImage(a,d.imageSmoothingEnabled=0,0,1920,1080))
JSFiddle
$endgroup$
$begingroup$
How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle
$endgroup$
– someone
May 27 at 12:16
$begingroup$
Thanks, I'm not sure what happened.
$endgroup$
– Johan du Toit
May 27 at 12:29
1
$begingroup$
Are you sure you want the "SAVE" link at all? I think you can simply alertc.toDataUrl()
.
$endgroup$
– someone
May 27 at 13:50
$begingroup$
Yes, I was not sure about that.alert
does not show all the content, perhapsconsole.log
?
$endgroup$
– Johan du Toit
May 27 at 14:06
1
$begingroup$
@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them tozopflipng
and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at s000.tinyupload.com/index.php?file_id=18210440611599235182 .
$endgroup$
– someone
May 28 at 13:22
|
show 14 more comments
$begingroup$
HTML + Javascript, 607 591 527 bytes
Thank you Epicness and Someone.
HTML, 436 bytes
<img id=a src=data:;base64,UklGRgABAABXRUJQVlA4TPMAAAAvX0ANALXIcSTJkST68N2Xs2p6ZJgUYgEpOVBwcYtMwGKJpBDAL5EUqioEEAAFTf8n4Akeel/aoYdx8E3jdbec+Bj0CQIKAqIiKqjd3hEU1L/CRATRBWhApHdtTIzZysYT0r794RjJEja6QbvdpUT9W1xDMYkxMQYEjWM4HPkrhiZRGjZoojYx0THU87bTZpWN2U6bJGMxF1qbRQ69BMYY48POObP4kX5/5753WXNeKm2SAFRBVRKqWK2CKkjmvG1VVbHY7K+aM7lk5mS1qqlaq2raKuh/9u1jI0BVVQNzzmJ3VRVcNluTcPxlBPR/7f3rMRIA><a id=b download>SAVE<canvas id=c width=1920 height=1080
Javascript, 91 bytes
b.href=c.toDataURL((d=c.getContext`2d`).drawImage(a,d.imageSmoothingEnabled=0,0,1920,1080))
JSFiddle
$endgroup$
$begingroup$
How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle
$endgroup$
– someone
May 27 at 12:16
$begingroup$
Thanks, I'm not sure what happened.
$endgroup$
– Johan du Toit
May 27 at 12:29
1
$begingroup$
Are you sure you want the "SAVE" link at all? I think you can simply alertc.toDataUrl()
.
$endgroup$
– someone
May 27 at 13:50
$begingroup$
Yes, I was not sure about that.alert
does not show all the content, perhapsconsole.log
?
$endgroup$
– Johan du Toit
May 27 at 14:06
1
$begingroup$
@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them tozopflipng
and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at s000.tinyupload.com/index.php?file_id=18210440611599235182 .
$endgroup$
– someone
May 28 at 13:22
|
show 14 more comments
$begingroup$
HTML + Javascript, 607 591 527 bytes
Thank you Epicness and Someone.
HTML, 436 bytes
<img id=a src=data:;base64,UklGRgABAABXRUJQVlA4TPMAAAAvX0ANALXIcSTJkST68N2Xs2p6ZJgUYgEpOVBwcYtMwGKJpBDAL5EUqioEEAAFTf8n4Akeel/aoYdx8E3jdbec+Bj0CQIKAqIiKqjd3hEU1L/CRATRBWhApHdtTIzZysYT0r794RjJEja6QbvdpUT9W1xDMYkxMQYEjWM4HPkrhiZRGjZoojYx0THU87bTZpWN2U6bJGMxF1qbRQ69BMYY48POObP4kX5/5753WXNeKm2SAFRBVRKqWK2CKkjmvG1VVbHY7K+aM7lk5mS1qqlaq2raKuh/9u1jI0BVVQNzzmJ3VRVcNluTcPxlBPR/7f3rMRIA><a id=b download>SAVE<canvas id=c width=1920 height=1080
Javascript, 91 bytes
b.href=c.toDataURL((d=c.getContext`2d`).drawImage(a,d.imageSmoothingEnabled=0,0,1920,1080))
JSFiddle
$endgroup$
HTML + Javascript, 607 591 527 bytes
Thank you Epicness and Someone.
HTML, 436 bytes
<img id=a src=data:;base64,UklGRgABAABXRUJQVlA4TPMAAAAvX0ANALXIcSTJkST68N2Xs2p6ZJgUYgEpOVBwcYtMwGKJpBDAL5EUqioEEAAFTf8n4Akeel/aoYdx8E3jdbec+Bj0CQIKAqIiKqjd3hEU1L/CRATRBWhApHdtTIzZysYT0r794RjJEja6QbvdpUT9W1xDMYkxMQYEjWM4HPkrhiZRGjZoojYx0THU87bTZpWN2U6bJGMxF1qbRQ69BMYY48POObP4kX5/5753WXNeKm2SAFRBVRKqWK2CKkjmvG1VVbHY7K+aM7lk5mS1qqlaq2raKuh/9u1jI0BVVQNzzmJ3VRVcNluTcPxlBPR/7f3rMRIA><a id=b download>SAVE<canvas id=c width=1920 height=1080
Javascript, 91 bytes
b.href=c.toDataURL((d=c.getContext`2d`).drawImage(a,d.imageSmoothingEnabled=0,0,1920,1080))
JSFiddle
edited May 29 at 15:12
answered May 27 at 12:00
Johan du ToitJohan du Toit
1,5045 silver badges11 bronze badges
1,5045 silver badges11 bronze badges
$begingroup$
How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle
$endgroup$
– someone
May 27 at 12:16
$begingroup$
Thanks, I'm not sure what happened.
$endgroup$
– Johan du Toit
May 27 at 12:29
1
$begingroup$
Are you sure you want the "SAVE" link at all? I think you can simply alertc.toDataUrl()
.
$endgroup$
– someone
May 27 at 13:50
$begingroup$
Yes, I was not sure about that.alert
does not show all the content, perhapsconsole.log
?
$endgroup$
– Johan du Toit
May 27 at 14:06
1
$begingroup$
@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them tozopflipng
and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at s000.tinyupload.com/index.php?file_id=18210440611599235182 .
$endgroup$
– someone
May 28 at 13:22
|
show 14 more comments
$begingroup$
How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle
$endgroup$
– someone
May 27 at 12:16
$begingroup$
Thanks, I'm not sure what happened.
$endgroup$
– Johan du Toit
May 27 at 12:29
1
$begingroup$
Are you sure you want the "SAVE" link at all? I think you can simply alertc.toDataUrl()
.
$endgroup$
– someone
May 27 at 13:50
$begingroup$
Yes, I was not sure about that.alert
does not show all the content, perhapsconsole.log
?
$endgroup$
– Johan du Toit
May 27 at 14:06
1
$begingroup$
@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them tozopflipng
and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at s000.tinyupload.com/index.php?file_id=18210440611599235182 .
$endgroup$
– someone
May 28 at 13:22
$begingroup$
How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle
$endgroup$
– someone
May 27 at 12:16
$begingroup$
How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle
$endgroup$
– someone
May 27 at 12:16
$begingroup$
Thanks, I'm not sure what happened.
$endgroup$
– Johan du Toit
May 27 at 12:29
$begingroup$
Thanks, I'm not sure what happened.
$endgroup$
– Johan du Toit
May 27 at 12:29
1
1
$begingroup$
Are you sure you want the "SAVE" link at all? I think you can simply alert
c.toDataUrl()
.$endgroup$
– someone
May 27 at 13:50
$begingroup$
Are you sure you want the "SAVE" link at all? I think you can simply alert
c.toDataUrl()
.$endgroup$
– someone
May 27 at 13:50
$begingroup$
Yes, I was not sure about that.
alert
does not show all the content, perhaps console.log
?$endgroup$
– Johan du Toit
May 27 at 14:06
$begingroup$
Yes, I was not sure about that.
alert
does not show all the content, perhaps console.log
?$endgroup$
– Johan du Toit
May 27 at 14:06
1
1
$begingroup$
@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them to
zopflipng
and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at s000.tinyupload.com/index.php?file_id=18210440611599235182 .$endgroup$
– someone
May 28 at 13:22
$begingroup$
@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them to
zopflipng
and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at s000.tinyupload.com/index.php?file_id=18210440611599235182 .$endgroup$
– someone
May 28 at 13:22
|
show 14 more comments
$begingroup$
C# (Visual C# Interactive Compiler), 707 bytes
#r"System.Drawing"
using System.Drawing.Drawing2D;dynamic a=new Bitmap(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"))),b=new Bitmap(1920, 1080),c=Graphics.FromImage(b);c.InterpolationMode=(InterpolationMode)5;c.PixelOffsetMode=(PixelOffsetMode)4;c.DrawImage(a,0,0,1920,1080);b.Save("b.png");
Only compiles in the interactive window, saves the result in a file called b.png
$endgroup$
add a comment
|
$begingroup$
C# (Visual C# Interactive Compiler), 707 bytes
#r"System.Drawing"
using System.Drawing.Drawing2D;dynamic a=new Bitmap(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"))),b=new Bitmap(1920, 1080),c=Graphics.FromImage(b);c.InterpolationMode=(InterpolationMode)5;c.PixelOffsetMode=(PixelOffsetMode)4;c.DrawImage(a,0,0,1920,1080);b.Save("b.png");
Only compiles in the interactive window, saves the result in a file called b.png
$endgroup$
add a comment
|
$begingroup$
C# (Visual C# Interactive Compiler), 707 bytes
#r"System.Drawing"
using System.Drawing.Drawing2D;dynamic a=new Bitmap(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"))),b=new Bitmap(1920, 1080),c=Graphics.FromImage(b);c.InterpolationMode=(InterpolationMode)5;c.PixelOffsetMode=(PixelOffsetMode)4;c.DrawImage(a,0,0,1920,1080);b.Save("b.png");
Only compiles in the interactive window, saves the result in a file called b.png
$endgroup$
C# (Visual C# Interactive Compiler), 707 bytes
#r"System.Drawing"
using System.Drawing.Drawing2D;dynamic a=new Bitmap(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"))),b=new Bitmap(1920, 1080),c=Graphics.FromImage(b);c.InterpolationMode=(InterpolationMode)5;c.PixelOffsetMode=(PixelOffsetMode)4;c.DrawImage(a,0,0,1920,1080);b.Save("b.png");
Only compiles in the interactive window, saves the result in a file called b.png
answered May 27 at 2:04
Embodiment of IgnoranceEmbodiment of Ignorance
5,6543 silver badges31 bronze badges
5,6543 silver badges31 bronze badges
add a comment
|
add a comment
|
$begingroup$
C (GCC/MinGW), 1439 1406 1386 1382 1092 807 806 800 789 787 786 777 bytes
-33 -4 -11 -9 bytes thanks to ceilingcat
-6 bytes thanks to someone's idea
Edit: Why even dynamically calculate CRCs when the output is static? Dropping that part really slimmed things down.
Somewhat beefier than other entries, but such is C life.
Assumes sizeof(unsigned int) == 4
, i.e. 32-bit integers, and little-endianness.
The earlier RLE scheme is replaced by a slightly more complex one. Most of the image (except the "CONFIDENCE" text) is stored as a series of rectangles. Each rectangle is stored as four characters holding (x1, y1) and (x2 + 1, y2 + 1). We start with the lowest colour in the palette and upon hitting a space character in the image data, we increase the palette index.
I have a feeling further compression could be had by storing colours slightly differently and exploiting the additive nature of the colours of overlapping areas.
The "CONFIDENCE" text is stored as a series of characters holding 6 significant bits, each one of which corresponds to a "pixel" in the text.
#define Y*Q++-31
*o,C,x,i,W=5760,H=1080,Z[]=262749,394124,459939,8487086,8552901,8618449,~0;S(b,D,C,B,A,c)char*b;for(B*=20;B<D*20;B++)for(x=A*20;x<C*20;)bcopy(Z+c,b+B*W+x++*3,3);(*X)()=fwrite;main(j)char*p=calloc(W,H),d[]="x8126~xe9",*Q="&&<57)V;22?E;9LOI3eI[%o7_1yA 7)<;2275;2?EC9I;I3V;I;LI[3_7_1o7_7eA 72<5;9?;_3e7 C;E?G;I?M;O?W;Y?[;]?GAIEMAOEWAYEaAcE??CA?ECG]EaG]9_;]?_ALEMG ?9C;L9M;_9a;_?aAa;c?=A?EIELG I9L;";for(;*Q;)S(p,Y,Y,Y,Y,C+=*Q<33&&Y);for(X("x89PNGrn32nrIHDRax8048b2gxb1V24_5VIDATb35",1,43,o=fopen("a.png","wb"));i<240;i++)"FStuybLGitTTJfRAaTuUzjBGiTVTJrRAFSTtybLG"[i/6]-64>>i%6&1&&S(p,C+1,j+1,C=17+i/48,j=26+i/6%8*6+i%6,6);for(;H--;p+=X(p,1,W,o))*d=!H,X(d,1,6,o);X("*vC6xc7xe320WIEND256B`x82",1,20,o);
$endgroup$
$begingroup$
this segfaults on my machine.
$endgroup$
– don bright
May 27 at 19:12
1
$begingroup$
@donbright some compilers/runtimes require#include<stdio.h>
to avoid segfaulting.
$endgroup$
– ceilingcat
May 27 at 19:32
$begingroup$
is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?
$endgroup$
– don bright
May 27 at 19:38
1
$begingroup$
oh i see, "standard libraries" is acceptable. upvoted!
$endgroup$
– don bright
May 27 at 19:49
$begingroup$
Is 16777215-1u>>8
? That should save two bytes.
$endgroup$
– someone
Jun 1 at 12:28
|
show 3 more comments
$begingroup$
C (GCC/MinGW), 1439 1406 1386 1382 1092 807 806 800 789 787 786 777 bytes
-33 -4 -11 -9 bytes thanks to ceilingcat
-6 bytes thanks to someone's idea
Edit: Why even dynamically calculate CRCs when the output is static? Dropping that part really slimmed things down.
Somewhat beefier than other entries, but such is C life.
Assumes sizeof(unsigned int) == 4
, i.e. 32-bit integers, and little-endianness.
The earlier RLE scheme is replaced by a slightly more complex one. Most of the image (except the "CONFIDENCE" text) is stored as a series of rectangles. Each rectangle is stored as four characters holding (x1, y1) and (x2 + 1, y2 + 1). We start with the lowest colour in the palette and upon hitting a space character in the image data, we increase the palette index.
I have a feeling further compression could be had by storing colours slightly differently and exploiting the additive nature of the colours of overlapping areas.
The "CONFIDENCE" text is stored as a series of characters holding 6 significant bits, each one of which corresponds to a "pixel" in the text.
#define Y*Q++-31
*o,C,x,i,W=5760,H=1080,Z[]=262749,394124,459939,8487086,8552901,8618449,~0;S(b,D,C,B,A,c)char*b;for(B*=20;B<D*20;B++)for(x=A*20;x<C*20;)bcopy(Z+c,b+B*W+x++*3,3);(*X)()=fwrite;main(j)char*p=calloc(W,H),d[]="x8126~xe9",*Q="&&<57)V;22?E;9LOI3eI[%o7_1yA 7)<;2275;2?EC9I;I3V;I;LI[3_7_1o7_7eA 72<5;9?;_3e7 C;E?G;I?M;O?W;Y?[;]?GAIEMAOEWAYEaAcE??CA?ECG]EaG]9_;]?_ALEMG ?9C;L9M;_9a;_?aAa;c?=A?EIELG I9L;";for(;*Q;)S(p,Y,Y,Y,Y,C+=*Q<33&&Y);for(X("x89PNGrn32nrIHDRax8048b2gxb1V24_5VIDATb35",1,43,o=fopen("a.png","wb"));i<240;i++)"FStuybLGitTTJfRAaTuUzjBGiTVTJrRAFSTtybLG"[i/6]-64>>i%6&1&&S(p,C+1,j+1,C=17+i/48,j=26+i/6%8*6+i%6,6);for(;H--;p+=X(p,1,W,o))*d=!H,X(d,1,6,o);X("*vC6xc7xe320WIEND256B`x82",1,20,o);
$endgroup$
$begingroup$
this segfaults on my machine.
$endgroup$
– don bright
May 27 at 19:12
1
$begingroup$
@donbright some compilers/runtimes require#include<stdio.h>
to avoid segfaulting.
$endgroup$
– ceilingcat
May 27 at 19:32
$begingroup$
is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?
$endgroup$
– don bright
May 27 at 19:38
1
$begingroup$
oh i see, "standard libraries" is acceptable. upvoted!
$endgroup$
– don bright
May 27 at 19:49
$begingroup$
Is 16777215-1u>>8
? That should save two bytes.
$endgroup$
– someone
Jun 1 at 12:28
|
show 3 more comments
$begingroup$
C (GCC/MinGW), 1439 1406 1386 1382 1092 807 806 800 789 787 786 777 bytes
-33 -4 -11 -9 bytes thanks to ceilingcat
-6 bytes thanks to someone's idea
Edit: Why even dynamically calculate CRCs when the output is static? Dropping that part really slimmed things down.
Somewhat beefier than other entries, but such is C life.
Assumes sizeof(unsigned int) == 4
, i.e. 32-bit integers, and little-endianness.
The earlier RLE scheme is replaced by a slightly more complex one. Most of the image (except the "CONFIDENCE" text) is stored as a series of rectangles. Each rectangle is stored as four characters holding (x1, y1) and (x2 + 1, y2 + 1). We start with the lowest colour in the palette and upon hitting a space character in the image data, we increase the palette index.
I have a feeling further compression could be had by storing colours slightly differently and exploiting the additive nature of the colours of overlapping areas.
The "CONFIDENCE" text is stored as a series of characters holding 6 significant bits, each one of which corresponds to a "pixel" in the text.
#define Y*Q++-31
*o,C,x,i,W=5760,H=1080,Z[]=262749,394124,459939,8487086,8552901,8618449,~0;S(b,D,C,B,A,c)char*b;for(B*=20;B<D*20;B++)for(x=A*20;x<C*20;)bcopy(Z+c,b+B*W+x++*3,3);(*X)()=fwrite;main(j)char*p=calloc(W,H),d[]="x8126~xe9",*Q="&&<57)V;22?E;9LOI3eI[%o7_1yA 7)<;2275;2?EC9I;I3V;I;LI[3_7_1o7_7eA 72<5;9?;_3e7 C;E?G;I?M;O?W;Y?[;]?GAIEMAOEWAYEaAcE??CA?ECG]EaG]9_;]?_ALEMG ?9C;L9M;_9a;_?aAa;c?=A?EIELG I9L;";for(;*Q;)S(p,Y,Y,Y,Y,C+=*Q<33&&Y);for(X("x89PNGrn32nrIHDRax8048b2gxb1V24_5VIDATb35",1,43,o=fopen("a.png","wb"));i<240;i++)"FStuybLGitTTJfRAaTuUzjBGiTVTJrRAFSTtybLG"[i/6]-64>>i%6&1&&S(p,C+1,j+1,C=17+i/48,j=26+i/6%8*6+i%6,6);for(;H--;p+=X(p,1,W,o))*d=!H,X(d,1,6,o);X("*vC6xc7xe320WIEND256B`x82",1,20,o);
$endgroup$
C (GCC/MinGW), 1439 1406 1386 1382 1092 807 806 800 789 787 786 777 bytes
-33 -4 -11 -9 bytes thanks to ceilingcat
-6 bytes thanks to someone's idea
Edit: Why even dynamically calculate CRCs when the output is static? Dropping that part really slimmed things down.
Somewhat beefier than other entries, but such is C life.
Assumes sizeof(unsigned int) == 4
, i.e. 32-bit integers, and little-endianness.
The earlier RLE scheme is replaced by a slightly more complex one. Most of the image (except the "CONFIDENCE" text) is stored as a series of rectangles. Each rectangle is stored as four characters holding (x1, y1) and (x2 + 1, y2 + 1). We start with the lowest colour in the palette and upon hitting a space character in the image data, we increase the palette index.
I have a feeling further compression could be had by storing colours slightly differently and exploiting the additive nature of the colours of overlapping areas.
The "CONFIDENCE" text is stored as a series of characters holding 6 significant bits, each one of which corresponds to a "pixel" in the text.
#define Y*Q++-31
*o,C,x,i,W=5760,H=1080,Z[]=262749,394124,459939,8487086,8552901,8618449,~0;S(b,D,C,B,A,c)char*b;for(B*=20;B<D*20;B++)for(x=A*20;x<C*20;)bcopy(Z+c,b+B*W+x++*3,3);(*X)()=fwrite;main(j)char*p=calloc(W,H),d[]="x8126~xe9",*Q="&&<57)V;22?E;9LOI3eI[%o7_1yA 7)<;2275;2?EC9I;I3V;I;LI[3_7_1o7_7eA 72<5;9?;_3e7 C;E?G;I?M;O?W;Y?[;]?GAIEMAOEWAYEaAcE??CA?ECG]EaG]9_;]?_ALEMG ?9C;L9M;_9a;_?aAa;c?=A?EIELG I9L;";for(;*Q;)S(p,Y,Y,Y,Y,C+=*Q<33&&Y);for(X("x89PNGrn32nrIHDRax8048b2gxb1V24_5VIDATb35",1,43,o=fopen("a.png","wb"));i<240;i++)"FStuybLGitTTJfRAaTuUzjBGiTVTJrRAFSTtybLG"[i/6]-64>>i%6&1&&S(p,C+1,j+1,C=17+i/48,j=26+i/6%8*6+i%6,6);for(;H--;p+=X(p,1,W,o))*d=!H,X(d,1,6,o);X("*vC6xc7xe320WIEND256B`x82",1,20,o);
edited Jun 3 at 19:18
answered May 27 at 17:00
gastropnergastropner
2,8141 gold badge6 silver badges13 bronze badges
2,8141 gold badge6 silver badges13 bronze badges
$begingroup$
this segfaults on my machine.
$endgroup$
– don bright
May 27 at 19:12
1
$begingroup$
@donbright some compilers/runtimes require#include<stdio.h>
to avoid segfaulting.
$endgroup$
– ceilingcat
May 27 at 19:32
$begingroup$
is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?
$endgroup$
– don bright
May 27 at 19:38
1
$begingroup$
oh i see, "standard libraries" is acceptable. upvoted!
$endgroup$
– don bright
May 27 at 19:49
$begingroup$
Is 16777215-1u>>8
? That should save two bytes.
$endgroup$
– someone
Jun 1 at 12:28
|
show 3 more comments
$begingroup$
this segfaults on my machine.
$endgroup$
– don bright
May 27 at 19:12
1
$begingroup$
@donbright some compilers/runtimes require#include<stdio.h>
to avoid segfaulting.
$endgroup$
– ceilingcat
May 27 at 19:32
$begingroup$
is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?
$endgroup$
– don bright
May 27 at 19:38
1
$begingroup$
oh i see, "standard libraries" is acceptable. upvoted!
$endgroup$
– don bright
May 27 at 19:49
$begingroup$
Is 16777215-1u>>8
? That should save two bytes.
$endgroup$
– someone
Jun 1 at 12:28
$begingroup$
this segfaults on my machine.
$endgroup$
– don bright
May 27 at 19:12
$begingroup$
this segfaults on my machine.
$endgroup$
– don bright
May 27 at 19:12
1
1
$begingroup$
@donbright some compilers/runtimes require
#include<stdio.h>
to avoid segfaulting.$endgroup$
– ceilingcat
May 27 at 19:32
$begingroup$
@donbright some compilers/runtimes require
#include<stdio.h>
to avoid segfaulting.$endgroup$
– ceilingcat
May 27 at 19:32
$begingroup$
is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?
$endgroup$
– don bright
May 27 at 19:38
$begingroup$
is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?
$endgroup$
– don bright
May 27 at 19:38
1
1
$begingroup$
oh i see, "standard libraries" is acceptable. upvoted!
$endgroup$
– don bright
May 27 at 19:49
$begingroup$
oh i see, "standard libraries" is acceptable. upvoted!
$endgroup$
– don bright
May 27 at 19:49
$begingroup$
Is 16777215
-1u>>8
? That should save two bytes.$endgroup$
– someone
Jun 1 at 12:28
$begingroup$
Is 16777215
-1u>>8
? That should save two bytes.$endgroup$
– someone
Jun 1 at 12:28
|
show 3 more comments
$begingroup$
HTML + javascript, 504 bytes - Not competing
I still need to get the colors sorted out.
HTML, 35 bytes
<canvas id=g width=1920 height=1080
Javascript, 469 bytes
d=g.getContext`2d`
d[f='fillRect'](0,0,1920,1080)
d[a='globalAlpha']=.4
d[l='fillStyle']=`#a00`
'//>7|@2G:|;;5;|DB9>|R<D>|d.<:|h:B8'.split`|`.map(x=>x.split``.map(c=>(c[w='charCodeAt']()-40)*20)).map(x=>d[f](...x))
d[l]='#fff'
d[a]=1
q=(h,x,y,p,z)=>b=atob(h).split``;for(var n in b)0)*z,z,z);
q('xkTXucgcKU1RiikFIVVXuiocKWVRiiwFxkTRucgc',520,340,6,20)
d[a]=.4
q('xgADKKEEKKEEBgADISEEISEExgAD',600,520,3,40)
JSFiddle
$endgroup$
$begingroup$
I believe you can replace the...,y+((n/p)|0)*z...
bit with...,y+~~(n/p)*z
, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.
$endgroup$
– someone
May 28 at 14:28
$begingroup$
Without the|0
it calculates a floating point value that blurs the image.
$endgroup$
– Johan du Toit
May 28 at 14:57
$begingroup$
Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggestgpick
for Linux orColorPix
for Windows.
$endgroup$
– someone
May 28 at 15:04
$begingroup$
I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.
$endgroup$
– Johan du Toit
May 28 at 15:15
$begingroup$
See Diff results for Chrome vs Firefox
$endgroup$
– Johan du Toit
May 29 at 14:38
add a comment
|
$begingroup$
HTML + javascript, 504 bytes - Not competing
I still need to get the colors sorted out.
HTML, 35 bytes
<canvas id=g width=1920 height=1080
Javascript, 469 bytes
d=g.getContext`2d`
d[f='fillRect'](0,0,1920,1080)
d[a='globalAlpha']=.4
d[l='fillStyle']=`#a00`
'//>7|@2G:|;;5;|DB9>|R<D>|d.<:|h:B8'.split`|`.map(x=>x.split``.map(c=>(c[w='charCodeAt']()-40)*20)).map(x=>d[f](...x))
d[l]='#fff'
d[a]=1
q=(h,x,y,p,z)=>b=atob(h).split``;for(var n in b)0)*z,z,z);
q('xkTXucgcKU1RiikFIVVXuiocKWVRiiwFxkTRucgc',520,340,6,20)
d[a]=.4
q('xgADKKEEKKEEBgADISEEISEExgAD',600,520,3,40)
JSFiddle
$endgroup$
$begingroup$
I believe you can replace the...,y+((n/p)|0)*z...
bit with...,y+~~(n/p)*z
, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.
$endgroup$
– someone
May 28 at 14:28
$begingroup$
Without the|0
it calculates a floating point value that blurs the image.
$endgroup$
– Johan du Toit
May 28 at 14:57
$begingroup$
Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggestgpick
for Linux orColorPix
for Windows.
$endgroup$
– someone
May 28 at 15:04
$begingroup$
I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.
$endgroup$
– Johan du Toit
May 28 at 15:15
$begingroup$
See Diff results for Chrome vs Firefox
$endgroup$
– Johan du Toit
May 29 at 14:38
add a comment
|
$begingroup$
HTML + javascript, 504 bytes - Not competing
I still need to get the colors sorted out.
HTML, 35 bytes
<canvas id=g width=1920 height=1080
Javascript, 469 bytes
d=g.getContext`2d`
d[f='fillRect'](0,0,1920,1080)
d[a='globalAlpha']=.4
d[l='fillStyle']=`#a00`
'//>7|@2G:|;;5;|DB9>|R<D>|d.<:|h:B8'.split`|`.map(x=>x.split``.map(c=>(c[w='charCodeAt']()-40)*20)).map(x=>d[f](...x))
d[l]='#fff'
d[a]=1
q=(h,x,y,p,z)=>b=atob(h).split``;for(var n in b)0)*z,z,z);
q('xkTXucgcKU1RiikFIVVXuiocKWVRiiwFxkTRucgc',520,340,6,20)
d[a]=.4
q('xgADKKEEKKEEBgADISEEISEExgAD',600,520,3,40)
JSFiddle
$endgroup$
HTML + javascript, 504 bytes - Not competing
I still need to get the colors sorted out.
HTML, 35 bytes
<canvas id=g width=1920 height=1080
Javascript, 469 bytes
d=g.getContext`2d`
d[f='fillRect'](0,0,1920,1080)
d[a='globalAlpha']=.4
d[l='fillStyle']=`#a00`
'//>7|@2G:|;;5;|DB9>|R<D>|d.<:|h:B8'.split`|`.map(x=>x.split``.map(c=>(c[w='charCodeAt']()-40)*20)).map(x=>d[f](...x))
d[l]='#fff'
d[a]=1
q=(h,x,y,p,z)=>b=atob(h).split``;for(var n in b)0)*z,z,z);
q('xkTXucgcKU1RiikFIVVXuiocKWVRiiwFxkTRucgc',520,340,6,20)
d[a]=.4
q('xgADKKEEKKEEBgADISEEISEExgAD',600,520,3,40)
JSFiddle
edited May 28 at 15:11
answered May 28 at 7:58
Johan du ToitJohan du Toit
1,5045 silver badges11 bronze badges
1,5045 silver badges11 bronze badges
$begingroup$
I believe you can replace the...,y+((n/p)|0)*z...
bit with...,y+~~(n/p)*z
, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.
$endgroup$
– someone
May 28 at 14:28
$begingroup$
Without the|0
it calculates a floating point value that blurs the image.
$endgroup$
– Johan du Toit
May 28 at 14:57
$begingroup$
Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggestgpick
for Linux orColorPix
for Windows.
$endgroup$
– someone
May 28 at 15:04
$begingroup$
I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.
$endgroup$
– Johan du Toit
May 28 at 15:15
$begingroup$
See Diff results for Chrome vs Firefox
$endgroup$
– Johan du Toit
May 29 at 14:38
add a comment
|
$begingroup$
I believe you can replace the...,y+((n/p)|0)*z...
bit with...,y+~~(n/p)*z
, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.
$endgroup$
– someone
May 28 at 14:28
$begingroup$
Without the|0
it calculates a floating point value that blurs the image.
$endgroup$
– Johan du Toit
May 28 at 14:57
$begingroup$
Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggestgpick
for Linux orColorPix
for Windows.
$endgroup$
– someone
May 28 at 15:04
$begingroup$
I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.
$endgroup$
– Johan du Toit
May 28 at 15:15
$begingroup$
See Diff results for Chrome vs Firefox
$endgroup$
– Johan du Toit
May 29 at 14:38
$begingroup$
I believe you can replace the
...,y+((n/p)|0)*z...
bit with ...,y+~~(n/p)*z
, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.$endgroup$
– someone
May 28 at 14:28
$begingroup$
I believe you can replace the
...,y+((n/p)|0)*z...
bit with ...,y+~~(n/p)*z
, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.$endgroup$
– someone
May 28 at 14:28
$begingroup$
Without the
|0
it calculates a floating point value that blurs the image.$endgroup$
– Johan du Toit
May 28 at 14:57
$begingroup$
Without the
|0
it calculates a floating point value that blurs the image.$endgroup$
– Johan du Toit
May 28 at 14:57
$begingroup$
Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggest
gpick
for Linux or ColorPix
for Windows.$endgroup$
– someone
May 28 at 15:04
$begingroup$
Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggest
gpick
for Linux or ColorPix
for Windows.$endgroup$
– someone
May 28 at 15:04
$begingroup$
I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.
$endgroup$
– Johan du Toit
May 28 at 15:15
$begingroup$
I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.
$endgroup$
– Johan du Toit
May 28 at 15:15
$begingroup$
See Diff results for Chrome vs Firefox
$endgroup$
– Johan du Toit
May 29 at 14:38
$begingroup$
See Diff results for Chrome vs Firefox
$endgroup$
– Johan du Toit
May 29 at 14:38
add a comment
|
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f186120%2fusing-the-smallest-number-of-bytes-of-code-write-a-program-that-produces-this-i%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
$begingroup$
What do you mean by "external libraries?"
$endgroup$
– Esolanging Fruit
May 26 at 7:36
3
$begingroup$
These always end up being full of long strings being base64decoded. Can you tell us more about the image, to help facilitate other approaches?
$endgroup$
– Aaron F
May 26 at 10:33
10
$begingroup$
The secondary task of golfing a PNG encoder seems like it might overshadow the main thrust of the challenge.
$endgroup$
– gastropner
May 26 at 11:15
5
$begingroup$
@d33tah I believe this still fits the Cumbersome IO formats thing from "Things to avoid when writing challenges" extremely well. In particular, a PNG file has CRC checksums that have to be calculated.
$endgroup$
– someone
May 26 at 12:12
5
$begingroup$
Someone want to do this in Piet?
$endgroup$
– msh210
May 26 at 13:42