Tikz, 175 bytes
\documentclass[tikz]{standalone}\begin{document}\tikz{\def\b{;\draw[line width=}\def\a{)--(}\clip(1,1\a1,5\a5,5\a5,1)\b2mm](0,4\a6,4\a6,3\a4,3)\b1mm](4,0\a4,5);}\end{document}
Verify it in the Blogosphere
This is perhaps one of Mondrian's most minimalistic works and I am surprised no one has found it yet. It is not however particularly interesting so I have included several other paintings in my answer.
Explanation
There is a bit of a wrapper that is associated with every tikz answer. The wrapper is:
\documentclass[tikz]{standalone}\begin{document}\tikz{
}\end{document}
Once you get past the wrapper there are a few \def
statements that save bytes but unfortunately obfuscate the code:
\def\b{;\draw[line width=}\def\a{)--(}
If we make all the proper substitutions our code comes out looking like:
\clip(1,1)--(1,5)--(5,5)--(5,1);
\draw[line width=2mm](0,4)--(6,4)--(6,3)--(4,3);
\draw[line width=1mm](4,0)--(4,5);
The first bit is a \clip
and is very important, but we will skip over it for the time being.
Now we draw the first line on the blank canvas, This line is rather thick so we use [line width=2mm]
to set the thickness to 2mm
:
\draw[line width=2mm](0,4)--(6,4)--(6,3)--(4,3);
This connects a couple of nodes and produces this shape:
![](../../I/static/images/3310a432e15a8520c78045cf5f7edc977777aff838785bd6d20997953925b2d2.png)
Next we \draw
a second stroke, however this stroke is thinner so we have to set the line thickness to 1mm
:
\draw[line width=1mm](4,0)--(4,5);
Now our painting looks like:
![](../../I/static/images/d058b39b1e5bf64ea0cf5e8e75f8a542a2b94a21d2ab050403561fd94a1522bf.png)
This is close to the original but not quite, so here is where the \clip
comes into play. We use the \clip
to remove all the extra lines from our canvas and set the canvas to the correct size. With the canvas resized we get the image:
![Composition III in Black and White](../../I/static/images/e1722d892f54d3374ec5ab9ecc7e8a8053a02ad28f9604cbe99dc3469039ed6b.png)
\documentclass[tikz]{standalone}\begin{document}\tikz[line width=2mm]{\clip(1,1)rectangle(7,7);\draw(0,8)rectangle(4,3.5)rectangle(6.5,1.2)rectangle(4,0);\draw[fill=yellow](6.5,3.5)rectangle(8,2.5);}\end{document}
Evaluate it in CyberSpace
Explanation to come
\documentclass[tikz]{standalone}\begin{document}\tikz[line width=2mm]{\clip(1,1)rectangle(7,10);\draw(8,9)rectangle(3,6)rectangle(0,0);\draw[fill=yellow](0,0)rectangle(3,2);\draw[fill=blue](0,11)rectangle(3,9);}\end{document}
Assess it over the Webbernetz!
Explanation to come
\documentclass[tikz]{standalone}\begin{document}\tikz[line width=2mm]{\clip(1,1)rectangle(10,13);\draw[line width=1mm](1.2,5)--(1.2,9);\draw[fill=red](0,14)rectangle(5,9);\draw(0,9)rectangle(11,5)(7,0)rectangle(5,14);}\end{document}
Attempt it within the Internet!
Explanation
First here is the code with line breaks inserted to make it more readable:
\documentclass[tikz]{standalone}
\begin{document}
\tikz[line width=2mm]{
\clip(1,1)rectangle(10,13);
\draw[line width=1mm](1.2,5)--(1.2,9);
\draw[fill=red](0,14)rectangle(5,9);
\draw(0,9)rectangle(11,5)(7,0)rectangle(5,14);
}
\end{document}
The first command of interest is
\draw[fill=red](0,14)rectangle(5,9);
This draws a red rectangle with a black outline. For the upper left hand corner of the painting.
![](../../I/static/images/6d14f90e5b42873dcea86919788fbc537383c24db362323a1018e252d8c83260.png)
We then draw two more rectangles with white interiors and black outlines to create the grid pattern on the painting
\draw(0,9)rectangle(11,5)(7,0)rectangle(5,14);
![](../../I/static/images/ea306c3f0196508e8bbf55879c4909eb5a6562495bb87378a6b1497506180415.png)
We then draw in a thin line
\draw[line width=1mm](1.2,5)--(1.2,9);
![](../../I/static/images/122072bb1211400c46f922ee82898552da24cc52b07a0da52654556e333a16b1.png)
And crop the image to the proper size
\clip(1,1)rectangle(10,13);
![](../../I/static/images/8733ed845df55ead2a6c1d8ff071143aa17d8ce01901b35ac4f965c05c430836.png)
\documentclass[tikz]{standalone}\begin{document}\tikz[line width=1mm]{\clip(1,1)rectangle(9,9);\draw[fill=yellow](8.5,6)--(0,6)--(8.5,6)--(8.5,2)rectangle(10,0);\draw[fill=red](3,3)rectangle(10,10);\draw[fill=blue](0,0)rectangle(3,3);}\end{document}
Test it upon the World Wide Web!
Explanation
First I will insert some line breaks to make my code readable
\documentclass[tikz]{standalone}
\begin{document}
\tikz[line width=1mm]{
\clip(1,1)rectangle(9,9);
\draw[fill=yellow](8.5,6)--(0,6)--(8.5,6)--(8.5,2)rectangle(10,0);
\draw[fill=red](3,3)rectangle(10,10);
\draw[fill=blue](0,0)rectangle(3,3);
}
\end{document}
The first line of importance is:
\draw[fill=yellow](8.5,6)--(0,6)--(8.5,6)--(8.5,2)rectangle(10,0);
This draws the following shape:
![](../../I/static/images/d04d1dafa4098966a03e0f762c72570d958cbae2a34688000695ac1efab5ee95.png)
This strange shape is the yellow rectangle in the lower right corner and the two lines that are no the edge of a colored rectangle. Next we insert the red square and cover up the extra lines made by the last shape:
\draw[fill=red](3,3)rectangle(10,10);
This comes out looking like:
![](../../I/static/images/f1d6cab2effda741af119f8b4aec249bdd6a49ba5764d477e754083fbb34c8d3.png)
Now we insert our blue square:
\draw[fill=blue](0,0)rectangle(3,3);
![](../../I/static/images/aff200026c56bc35b3bcc84d58b4f8deaf53e1d7f5706f1bfc5f2d125cd7c4ca.png)
Now all that is left is to crop out all the unnecessary parts of the image using a \clip
\clip(1,1)rectangle(10,10);
![Composition II in Red, Blue and Yellow](../../I/static/images/6333b93e98039a7b7db770732d35a0127017ec3d5aa3fadb09a50d745812c7a9.png)
\documentclass[tikz]{standalone}\begin{document}\tikz[line width=2mm]{\clip(1,1)rectangle(12.6,13);\draw(0,0)rectangle(10,4)rectangle(2,12)--(0,12);\draw[fill=red](10,1.6)rectangle(14,0);\draw[fill=yellow](6,12)rectangle(10,14);\draw[fill=blue](0,4)rectangle(2,8);\fill(10,10)rectangle(14,14);}\end{document}
Check it out on the Information-Super-Highway
Explanation to come
Step one: find a language with a built-in PNG, BMP or NetPBM encoder. – John Dvorak – 2013-09-21T05:02:29.277
I'm OK with that. In fact, I chose those formats because in PNG and BMPs case, lots of languages already support it, and in NetPBM's case, you don't really need an encoder - it has an ascii format which is a series of space separated numbers. – lochok – 2013-09-21T05:22:28.147
6
Relevant: Piet
– Griffin – 2013-09-21T10:56:58.9374It's a difficult language to work in... every now and then I attempt to do a Quine outputting NetPBM... but yeah. I'll be very impressed if anybody can recreate Piet Mondrian in Piet! – lochok – 2013-09-21T14:56:43.093
2@lochok I would offer a bounty for a Piet answer if anybody was seriously interested in trying. – Jerry Jeremiah – 2017-02-10T03:08:14.353
Is there any limit on how similar our image has to be to the original? – 12Me21 – 2017-02-11T04:31:59.150
Generally speaking, as close as possible - using either the correct colours or the 16 Windows colours. If it looks nothing like it - my suspicion is that people would be able to tell. – lochok – 2017-02-11T05:44:17.507
What about things like line thickness and position? – 12Me21 – 2017-02-11T16:48:19.337
2Can we output character art using terminal color escapes and block drawing characters? (eg. ▃▃▌) Or is this best posed as a different challenge? – Tobia – 2014-02-02T15:13:27.833