我得到了如下所示的视频测试图案。这是用其他相机拍摄的照片。它很模糊,我想自己生成一张数字照片。tikz 适合处理这样的图片吗?或者可以使用其他软件吗?
读完@Schrödinger's cat 的回复后我的草稿版本:
\documentclass[tikz,border=0mm]{standalone}
\usepackage{graphicx}
\usetikzlibrary{matrix,fit,positioning,calc,backgrounds}
\begin{document}
\begin{tikzpicture}[]
%\useasboundingbox (0,0) rectangle (5,5);
\def\rsize{4}
\def\d{0.5}
\tikzset{
background rectangle/.style={
fill={rgb,255:red,150; green,150; blue,150}
},show background rectangle,
% box1 and box2
box1/.style={draw,line width=2pt,minimum width={\rsize*1.8cm},minimum height={\rsize*1.8cm},anchor=center},
mat/.style={matrix,inner sep=0},
% colmat
pics/colmat/.style={code={
\tikzset{colmat/.cd,#1} \def\pv##1{\pgfkeysvalueof{/tikz/colmat/##1}}%
\edef\m{\pv{m}}%
\edef\w{1.8}%
\foreach \row [count=\j] in \m {
\foreach \r/\g/\b [count=\i] in \row {
\fill[fill={rgb,255:red,\r; green,\g; blue,\b}] (\i*\w-\w,\j*\w-\w) rectangle ++(\w,\w);
}%foreach
}%foreach
}},colmat/.cd,m/.initial={{255/0/0}},/tikz/.cd,
% rad
pics/rad/.style={code={
\tikzset{rad/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/rad/##1}}%
\fill[white] (0,0) -- (0:\pv{r}) arc[start angle=0,end angle=90,radius=\pv{r}]
-- (-90:\pv{r}) arc[start angle=-90,end angle=-180,radius=\pv{r}] -- cycle;
\fill[black] (0,0) -- (90:\pv{r}) arc[start angle=90,end angle=180,radius=\pv{r}]
-- (0:\pv{r}) arc[start angle=0,end angle=-90,radius=\pv{r}] -- cycle;
}},rad/.cd,r/.initial=1,/tikz/.cd,
% disk
pics/disk/.style={code={
\tikzset{disk/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/disk/##1}}%
\colorlet{diskfill}{\pv{fill}}%
\draw[diskfill] circle[radius=\pv{r}];
\fill[\pv{bg}] (0,0) foreach \XX in {1,2,...,120}
{ -- (0.5+\XX*3:0.9*\pv{r})
arc[start angle=0.5+\XX*3,end angle=2.5+\XX*3,radius=0.9*\pv{r}]
-- (0,0) };
\path (0,0) pic{rad};
\draw[\pv{bg},line width=5pt,pic actions] circle[radius=0.95*\pv{r}];
}},disk/.cd,bg/.initial=white,fill/.initial=gray!40,r/.initial=2,/tikz/.cd,
%mycross
pics/mycross/.style={code={
\draw[rotate = 0,line width=5pt] (-1,0) -- (1,0);
\draw[rotate = 0,line width=5pt] (0,-1) -- (0, 1);
}},
% random circles
pics/random circles/.style={code={
\tikzset{random circles/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/random circles/##1}}%
\colorlet{rfill}{\pv{fill}}%
\fill[rfill] (-0.5,-0.5) rectangle (0.5,0.5);
\clip (-0.5,-0.5) rectangle (0.5,0.5);
\foreach \XX in {1,...,\pv{n}}
{\pgfmathtruncatemacro{\itest}{(rnd<\pv{f} ? 0 :1)}
\ifnum\itest=0
\fill[white,opacity=\pv{opacity}] (-0.5+rnd,-0.5+rnd)
circle[radius=rnd*rnd*rnd*\pv{r}];
\else
\pgfmathtruncatemacro{\myR}{rnd*256-0.0001}%
\pgfmathtruncatemacro{\myG}{rnd*256-0.0001}%
\pgfmathtruncatemacro{\myB}{rnd*256-0.0001}%
\definecolor{myrnd}{RGB}{\myR,\myG,\myB}%
\fill[myrnd!50,opacity=\pv{opacity}] (-0.5+rnd,-0.5+rnd)
circle[radius=rnd*rnd*rnd*\pv{r}];
\fi}
}},random circles/.cd,r/.initial=0.2,n/.initial=120,fill/.initial=gray!40,
opacity/.initial=0.2,f/.initial=0.3,
};
\coordinate (O) at (0,0);
\def\r{35}
% corner disks with rads
\foreach \a [count=\i] in {30,150,-150,-30} {
\path[disk/r=\rsize] (O) ++ (\a:\r) pic{disk} coordinate (D\i);
\foreach \x [count=\j] in {45,135,...,360} {
\path (D\i) ++ (\x:{\rsize*1.3}) pic{rad={r=0.5}} coordinate(E-\i-\j);
}
}
% rads around side
\foreach \fx\fy/\tx/\ty in {1/1/2/2,2/2/3/3,3/3/4/4,4/4/1/1} {
\path (E-\fx-\fy) -- (E-\tx-\ty)
\foreach \j in {0,0.25,0.5,0.75} {
pic[pos=\j] {rad}
};
}
% cross
\foreach \i in {45,135,...,360} {
\path (0,0) ++(\i:{\rsize*4cm}) pic{mycross};
}
% disk side
\def\r{25}
\foreach \a in {15,-165} {
\path[disk/r=\rsize] (0,0) ++ (\a:\r) node[box1] {} pic{disk};
}
\foreach \a in {165,-15} {
\path[disk/r=\rsize,disk/bg=gray!50] (0,0) ++ (\a:\r) node[box1] {} pic{disk};
}
% center
\def\r{2}
\def\al{2*\rsize}
\def\bl{\rsize/2}
\draw[fill=black] (-\r,-\r) rectangle (\r,\r);
\foreach \t in {0,0.2,...,2} {
\draw[white,line width=\t] (0,0) circle (\t);
}
% 4 wheels
\def\xlst{
-45/238/229/225/35/20/17,
45/108/94/94/194/187/185,
135/195/188/186/111/100/97,
-135/40/28/27/239/230/226%
}
\foreach \a/\rx/\gx/\bx/\ry/\gy/\by[count=\i] in \xlst {
\draw[fill={rgb,255:red,\rx; green,\gx; blue,\bx}] (\a:{\r*sqrt(2)}) -- ([turn]45:\al) -- ([turn]90:\bl) coordinate (L\i) -- cycle;
\draw[fill={rgb,255:red,\ry; green,\gy; blue,\by}] (\a:{\r*sqrt(2)}) -- ([turn]135:\bl) -- ([turn]-90:\al) -- cycle;
}
% center grass
\def\offset{{(\rsize+\r)*sqrt(2)}}
\path[rad/r=0.5] (135:\offset) pic[scale={\rsize*2}]{random circles}
++ (45:{\rsize*sqrt(2)}) pic{rad} ++ (-{2*\rsize},0) pic{rad}
++ (0,-{2*\rsize}) pic{rad} ++ ({2*\rsize},0) pic{rad}
(-45:\offset) pic[scale={\rsize*2}]{random circles}
++ (45:{\rsize*sqrt(2)}) pic{rad} ++ (-{2*\rsize},0) pic{rad}
++ (0,-{2*\rsize}) pic{rad} ++ ({2*\rsize},0) pic{rad};
% center disks
\path[disk/r=\rsize] (0,0) ++ (45:\offset) pic{disk};
\path[disk/r=\rsize,disk/bg=gray!50] (0,0) ++ (-135:\offset) pic{disk};
% P start
\def\clst{
{245/240/235},
{233/226/224},
{223/216/214},
{209/202/200},
{190/183/181}%
}
\node[right=\d of L1,mat] (P1) {\pic{colmat={m=\clst}};\\};
\def\clst{
{255/251/244,255/255/255,255/255/255,255/255/254,255/246/242}%
}
\node[above=\d of L2,mat] (P2) {\pic{colmat={m=\clst}};\\};
\def\clst{
{252/243/238},
{242/234/228},
{231/222/218},
{216/209/207},
{200/193/191}%
}
\node[left=\d of L3,mat] (P3) {\pic{colmat={m=\clst}};\\};
\def\clst{
{177/171/169,123/113/114,27/17/12,40/32/30,152/145/145}%
}
\node[below=\d of L4,matrix] (P4) {\pic{colmat={m=\clst}};\\};
% P end
%M start
\def\clst{
{255/230/208,135/19/19,225/13/86},
{237/255/240,253/42/28,118/17/42},
{250/239/240,238/151/162,235/14/44},
{232/247/247,255/161/141,255/53/27},
{218/211/209,255/163/31,255/211/15},
{118/106/103,237/221/11,255/225/7},
{31/18/12,200/176/42,224/223/10},
{189/194/44,211/231/13,78/24/12}%
}
\node[right=\d of P1,mat] (M1) {\pic{colmat={m=\clst}};\\};
\def\clst{
{118/14/5,221/169/143,110/142/174,69/102/32,164/157/198,157/225/210},
{254/164/24,45/90/186,217/20/39,120/20/130,198/212/17,245/190/18},
{48/43/169,106/186/61,218/17/22,250/211/9,226/80/181,0/163/194},
{255/255/255,235/225/224,201/191/192,140/133/133,63/51/48,23/11/10}%
}
\node[above=\d of P2,mat] (M2) {\pic{colmat={m=\clst}};\\};
\def\clst{
{194/22/135,82/27/113,239/240/237},
{232/172/222,158/116/203,255/232/231},
{168/43/169,18/55/119,228/255/250},
{20/176/221,147/198/225,255/231/220},
{112/207/221,17/51/75,250/250/206},
{12/49/45,174/201/231,243/161/95},
{120/217/215,0/195/195,234/179/154},
{32/19/13,129/211/163,0/191/142}%
}
\node[left=\d of P3,mat] (M3) {\pic{colmat={m=\clst}};\\};
\def\clst{
{27/14/11,40/28/27,101/90/84,184/178/178,228/221/219,255/255/255},
{255/207/175,218/174/127,167/101/34,226/181/158,186/98/28,239/172/135},
{255/198/167,224/182/158,224/183/154,227/179/152,136/37/9,239/179/145},
{11/41/28,101/211/186,150/196/49,97/196/63,83/210/57,216/161/39}%
%
}
\node[below=\d of P4,mat] (M4) {\pic{colmat={m=\clst}};\\};
% M end
%
\draw[red] (current bounding box.north east) -- (current bounding box.north west) -- (current bounding box.south west) -- (current bounding box.south east) -- cycle;
% keep ratio
\def\ratio{16/9}
\path let \p1=(current bounding box.center),
\p2=(current bounding box.east),
\p3=(current bounding box.north),
\p4=(current bounding box.west),
\p5=(current bounding box.south),
\n1={\y3-\y1},
\n2={\n1*\ratio},
\n3={\y5 - \y1},
\n4={\n3*\ratio}
in
[use as bounding box] (\n4,\y5) rectangle (\n2,\y3);
\end{tikzpicture}
\end{document}
输出:
答案1
当然可以用 Ti 画出这样的图钾Z. 为了避免这变得过于繁琐,您可以定义pic
s。显然,我并没有尝试完全重现图片,而是给出了一些示例。
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[pics/random array/.style={code={
\tikzset{random array/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/random array/##1}}%
\edef\mysize{\pv{size}}%
\def\pft##1x##2;{\edef\mynx{##1}\edef\myny{##2}}%
\expandafter\pft\mysize;%
\foreach \XX in {1,...,\mynx}
{\foreach \YY in {1,...,\myny}
{\pgfmathtruncatemacro{\myR}{rnd*256-0.0001}%
\pgfmathtruncatemacro{\myG}{rnd*256-0.0001}%
\pgfmathtruncatemacro{\myB}{rnd*256-0.0001}%
\definecolor{myrnd}{RGB}{\myR,\myG,\myB}%
\fill[myrnd] (-\mynx/2+\XX-1,-\myny/2+\YY-1) rectangle ++ (1,1);
}}
%
}},random array/.cd,size/.initial=4x4,/tikz/.cd,
pics/rad/.style={code={
\tikzset{rad/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/rad/##1}}%
\fill[white] (0,0) -- (0:\pv{r}) arc[start angle=0,end angle=90,radius=\pv{r}]
-- (-90:\pv{r}) arc[start angle=-90,end angle=-180,radius=\pv{r}] -- cycle;
\fill[black] (0,0) -- (90:\pv{r}) arc[start angle=90,end angle=180,radius=\pv{r}]
-- (0:\pv{r}) arc[start angle=0,end angle=-90,radius=\pv{r}] -- cycle;
}},rad/.cd,r/.initial=0.2,/tikz/.cd,
pics/disk/.style={code={
\tikzset{disk/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/disk/##1}}%
\colorlet{diskfill}{\pv{fill}}%
\draw[diskfill] circle[radius=\pv{r}];
\fill[white] (0,0) foreach \XX in {1,...,120}
{ -- (0.5+\XX*3:0.9*\pv{r})
arc[start angle=0.5+\XX*3,end angle=2.5+\XX*3,radius=0.9*\pv{r}]
-- (0,0) };
\draw[white,pic actions] circle[radius=0.95*\pv{r}];
}},disk/.cd,fill/.initial=gray!40,r/.initial=1,/tikz/.cd,
]
\fill[gray!30] (-10,-8) rectangle (10,8);
\path (0,0) pic[scale=0.5]{random array={size={3x6}}}
(3,1) pic{rad}
(-4,-2) pic{disk} ++ (1,1) pic{rad} ++ (-2,0) pic{rad} ++ (0,-2) pic {rad}
++ (2,0) pic{rad};
\end{tikzpicture}
\end{document}
放大成圆形disk
。
附录:您更新中缺失的图片已添加。
\documentclass[tikz,border=3mm]{standalone}
%\usepackage{graphicx} %<- gets loaded by tikz
\usetikzlibrary{matrix,fit,positioning,calc,backgrounds}
\begin{document}
\begin{tikzpicture}[anchor=south west,background rectangle/.style={fill={rgb,255:red,150; green,150; blue,150}},
show background rectangle]
\tikzset{
box1/.style={draw,line width=2pt,minimum width=9cm,minimum height=9cm,anchor=center},
pics/rad/.style={code={
\tikzset{rad/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/rad/##1}}%
\fill[white] (0,0) -- (0:\pv{r}) arc[start angle=0,end angle=90,radius=\pv{r}]
-- (-90:\pv{r}) arc[start angle=-90,end angle=-180,radius=\pv{r}] -- cycle;
\fill[black] (0,0) -- (90:\pv{r}) arc[start angle=90,end angle=180,radius=\pv{r}]
-- (0:\pv{r}) arc[start angle=0,end angle=-90,radius=\pv{r}] -- cycle;
}},rad/.cd,r/.initial=1,/tikz/.cd,
pics/disk/.style={code={
\tikzset{disk/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/disk/##1}}%
\colorlet{diskfill}{\pv{fill}}%
\draw[diskfill] circle[radius=\pv{r}];
\fill[white] (0,0) foreach \XX in {1,...,120}
{ -- (0.5+\XX*3:0.9*\pv{r})
arc[start angle=0.5+\XX*3,end angle=2.5+\XX*3,radius=0.9*\pv{r}]
-- (0,0) };
\path (0,0) pic{rad};
\draw[white,line width=5pt,pic actions] circle[radius=0.95*\pv{r}];
}},disk/.cd,fill/.initial=gray!40,r/.initial=5,/tikz/.cd,
pics/random circles/.style={code={
\tikzset{random circles/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/random circles/##1}}%
\colorlet{rfill}{\pv{fill}}%
\fill[rfill] (-0.5,-0.5) rectangle (0.5,0.5);
\clip (-0.5,-0.5) rectangle (0.5,0.5);
\foreach \XX in {1,...,\pv{n}}
{\pgfmathtruncatemacro{\itest}{(rnd<\pv{f} ? 0 :1)}
\ifnum\itest=0
\fill[white,opacity=\pv{opacity}] (-0.5+rnd,-0.5+rnd)
circle[radius=rnd*rnd*rnd*\pv{r}];
\else
\pgfmathtruncatemacro{\myR}{rnd*256-0.0001}%
\pgfmathtruncatemacro{\myG}{rnd*256-0.0001}%
\pgfmathtruncatemacro{\myB}{rnd*256-0.0001}%
\definecolor{myrnd}{RGB}{\myR,\myG,\myB}%
\fill[myrnd!50,opacity=\pv{opacity}] (-0.5+rnd,-0.5+rnd)
circle[radius=rnd*rnd*rnd*\pv{r}];
\fi}
}},random circles/.cd,r/.initial=0.2,n/.initial=120,fill/.initial=gray!40,
opacity/.initial=0.2,f/.initial=0.3
};
\path[rad/r=0.5] (135:12) pic[scale=10]{random circles}
++ (45:{5*sqrt(2)}) pic{rad} ++ (-10,0) pic{rad}
++ (0,-10) pic{rad} ++ (10,0) pic{rad}
(-45:12) pic[scale=10]{random circles}
++ (45:{5*sqrt(2)}) pic{rad} ++ (-10,0) pic{rad}
++ (0,-10) pic{rad} ++ (10,0) pic{rad};
\coordinate (O) at (0,0);
\def\r{40}
\foreach \alpha [count=\i] in {30,150,-150,-30} {
\path (0,0) ++ (\alpha:\r) pic{disk} coordinate (D\i);
\foreach \x in {45,135,...,360} {
\path (D\i) ++ (\x:7) pic{rad={r=0.5}};
}
}
\path ([yshift=8cm]D1) -- ([yshift=8cm]D2) pic[pos=0.5]{rad} pic[pos=0.5]{rad} pic[pos=0.3]{rad} pic[pos=0]{rad} pic[pos=1]{rad};
\path ([yshift=-8cm]D3) -- ([yshift=-8cm]D4) pic[pos=0.5]{rad} pic[pos=0.3]{rad} pic[pos=0.7]{rad} pic[pos=0]{rad} pic[pos=1]{rad};
\path ([xshift=8cm]D1) -- ([xshift=8cm]D4) pic[pos=0.5]{rad} pic[pos=0.3]{rad} pic[pos=0.7]{rad};
\path ([xshift=-8cm]D2) -- ([xshift=-8cm]D3) pic[pos=0.5]{rad} pic[pos=0.3]{rad} pic[pos=0.7]{rad};
\def\x{30}
\def\y{7}
%\path (0,0) ++ (\x,\y) };
\path (0,0) ++ (\x,\y) node[box1] {} pic{disk};
\path (0,0) ++ (-\x,\y) node[box1] {} pic{disk};
\path (0,0) ++ (-\x,-\y) node[box1] {} pic{disk};
\path (0,0) ++ (\x,-\y) node[box1] {} pic{disk};
\path (0,0) ++ (45:12) pic{disk};
\path (0,0) ++ (-135:12) pic{disk};
\def\r{2}
\def\al{12}
\def\bl{3}
\draw[fill=black] (-\r,-\r) rectangle (\r,\r);
\foreach \t in {0,0.2,...,2} {
\draw[white,line width=\t] (0,0) circle (\t);
}
\def\xlst{
-45/238/229/225/35/20/17,
45/108/94/94/194/187/185,
135/195/188/186/111/100/97,
-135/40/28/27/239/230/226%
}
\foreach \a/\rx/\gx/\bx/\ry/\gy/\by[count=\i] in \xlst {
\draw[fill={rgb,255:red,\rx; green,\gx; blue,\bx}] (\a:{\r*sqrt(2)}) -- ([turn]45:\al) -- ([turn]90:\bl) coordinate (L\i) -- cycle;
\draw[fill={rgb,255:red,\ry; green,\gy; blue,\by}] (\a:{\r*sqrt(2)}) -- ([turn]135:\bl) -- ([turn]-90:\al) -- cycle;
}
\matrix [left=4cm of L3 ,matrix of nodes,draw,
nodes in empty cells,anchor=east,
row sep=-\pgflinewidth,
nodes={draw,
minimum height=2cm,
minimum width=2cm,
outer sep=0pt,
align=center},
] (M1)
{
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
};
\def\clst{
{194/22/135,82/27/113,239/240/237},
{232/172/222,158/116/203,255/232/231},
{168/43/169,18/55/119,228/255/250},
{20/176/221,147/198/225,255/231/220},
{112/207/221,17/51/75,250/250/206},
{12/49/45,174/201/231,243/161/95},
{120/217/215,0/195/195,234/179/154},
{32/19/13,129/211/163,0/191/142}%
}
\foreach \row[count=\rn] in \clst {
\foreach \r/\g/\b[count=\cn] in \row {
\node[fill={rgb,255:red,\r; green,\g; blue,\b}, fit=(M1-\rn-\cn) ] {};
}
}
% P start
\matrix [right=1cm of L1,matrix of nodes,draw,
nodes in empty cells,anchor=west,
row sep=-\pgflinewidth,
nodes={draw,
minimum height=2cm,
minimum width=2cm,
outer sep=0pt,
align=center},
] (M2)
{
\\
\\
\\
\\
\\
};
\def\clst{
{245/240/235},
{233/226/224},
{223/216/214},
{209/202/200},
{190/183/181}%
}
\foreach \row[count=\rn] in \clst {
\foreach \r/\g/\b[count=\cn] in \row {
\node[fill={rgb,255:red,\r; green,\g; blue,\b}, fit=(M2-\rn-\cn) ] {};
}
}
\matrix [above=1cm of L2,matrix of nodes,draw,
nodes in empty cells,anchor=south,
row sep=-\pgflinewidth,
nodes={draw,
minimum height=2cm,
minimum width=2cm,
outer sep=0pt,
align=center},
] (M2)
{
& & & & \\
};
\def\clst{
{255/251/244,255/255/255,255/255/255,255/255/254,255/246/242}%
}
\foreach \row[count=\rn] in \clst {
\foreach \r/\g/\b[count=\cn] in \row {
\node[fill={rgb,255:red,\r; green,\g; blue,\b}, fit=(M2-\rn-\cn) ] {};
}
}
\matrix [left=1cm of L3,matrix of nodes,draw,
nodes in empty cells,anchor=east,
row sep=-\pgflinewidth,
nodes={draw,
minimum height=2cm,
minimum width=2cm,
outer sep=0pt,
align=center},
] (M2)
{
\\
\\
\\
\\
\\
};
\def\clst{
{252/243/238},
{242/234/228},
{231/222/218},
{216/209/207},
{200/193/191}%
}
\foreach \row[count=\rn] in \clst {
\foreach \r/\g/\b[count=\cn] in \row {
\node[fill={rgb,255:red,\r; green,\g; blue,\b}, fit=(M2-\rn-\cn) ] {};
}
}
% P end
\matrix [right=4cm of L1,matrix of nodes,draw,
nodes in empty cells,anchor=west,
row sep=-\pgflinewidth,
nodes={draw,
minimum height=2cm,
minimum width=2cm,
outer sep=0pt,
align=center},
] (M2)
{
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
};
\def\clst{
{255/230/208,135/19/19,225/13/86},
{237/255/240,253/42/28,118/17/42},
{250/239/240,238/151/162,235/14/44},
{232/247/247,255/161/141,255/53/27},
{218/211/209,255/163/31,255/211/15},
{118/106/103,237/221/11,255/225/7},
{31/18/12,200/176/42,224/223/10},
{189/194/44,211/231/13,78/24/12}%
}
\foreach \row[count=\rn] in \clst {
\foreach \r/\g/\b[count=\cn] in \row {
\node[fill={rgb,255:red,\r; green,\g; blue,\b}, fit=(M2-\rn-\cn) ] {};
}
}
\matrix [above=4cm of L2,matrix of nodes,draw,
nodes in empty cells,anchor=south,
row sep=-\pgflinewidth,
nodes={draw,
minimum height=2cm,
minimum width=2cm,
outer sep=0pt,
align=center},
] (M3)
{
& & & & & \\
& & & & & \\
& & & & & \\
& & & & & \\
};
\def\clst{
{118/14/5,221/169/143,110/142/174,69/102/32,164/157/198,157/225/210},
{254/164/24,45/90/186,217/20/39,120/20/130,198/212/17,245/190/18},
{48/43/169,106/186/61,218/17/22,250/211/9,226/80/181,0/163/194},
{255/255/255,235/225/224,201/191/192,140/133/133,63/51/48,23/11/10}%
}
\foreach \row[count=\rn] in \clst {
\foreach \r/\g/\b[count=\cn] in \row {
\node[fill={rgb,255:red,\r; green,\g; blue,\b}, fit=(M3-\rn-\cn) ] {};
}
}
\matrix [below=4 of L4,matrix of nodes,draw,
nodes in empty cells,anchor=north,
row sep=-\pgflinewidth,
nodes={draw,
minimum height=2cm,
minimum width=2cm,
outer sep=0pt,
align=center},
] (M4)
{
& & & & & \\
& & & & & \\
& & & & & \\
& & & & & \\
};
\def\clst{
{27/14/11,40/28/27,101/90/84,184/178/178,228/221/219,255/255/255},
{255/207/175,218/174/127,167/101/34,226/181/158,186/98/28,239/172/135},
{255/198/167,224/182/158,224/183/154,227/179/152,136/37/9,239/179/145},
{11/41/28,101/211/186,150/196/49,97/196/63,83/210/57,216/161/39}%
%
}
\foreach \row[count=\rn] in \clst {
\foreach \r/\g/\b[count=\cn] in \row {
\node[fill={rgb,255:red,\r; green,\g; blue,\b}, fit=(M4-\rn-\cn) ] {};
}
}
\end{tikzpicture}
\end{document}