7
$\begingroup$

I have been trying to test different textures for my Plot3D and stumbled upon these examples given in the MMA Documentation for Texture,

example1 example2

What is the source of these textures? I tried to search in ExampleData but in vain.

If they are part of some other data, how can I recreate such textures without using copy-paste?

$\endgroup$
8
  • $\begingroup$ I don't really understand the purpose of this question. These are raster images, just like any other image. Someone created them in some way (be it with Mathematica or some other image processing software) or copied them from the internet, and then used them in the documentation ... $\endgroup$
    – Domen
    Feb 21 at 13:17
  • $\begingroup$ @Domen so they are not from ExampleData? I was just curious as normally all the images used in the documentation were from the already present data itself. $\endgroup$
    – codebpr
    Feb 21 at 13:35
  • $\begingroup$ I think the source is inside the help notebook itself. i.e. the image is embedded in the help notebook that you opened. If you look at the InputForm of the commands you showed, you see Image followed by the data itself of the image, right in there. So it is not reading the image from some file on the disk. I also looked at Image Information of the image (right click), and it shows no file name or anything like this. $\endgroup$
    – Nasser
    Feb 21 at 13:50
  • 1
    $\begingroup$ @codebpr, there is really nothing special or neat going on here – it's just the image in the notebook, ie. an expression with head Image and the corresponding data (pixel values). The same happens when you copy&paste an image into a notebook or import it via Import or obtain it from ExampleData. $\endgroup$
    – Domen
    Feb 21 at 13:59
  • 1
    $\begingroup$ @codebpr I do not think you need to be sorry. I think it is a good question. Any person seeing an image displayed would naturally expects it to be read from a disk file somewhere. It is just that a Mathematica notebook can contain inside it images and even videos and many other things, all encoded in text format as needed. (compressed or not) $\endgroup$
    – Nasser
    Feb 21 at 14:17

2 Answers 2

4
$\begingroup$

You can read them from the notebook. The ColorSpace option of one of the images gets corrupted the process, though. Changing ColorSpace to ColorSpace -> Automatic doesn't cause much change in that image. You can Reap it from the following, if you really want it.

nb = NotebookOpen[
   Documentation`ResolveLink["paclet:ref/Texture", "English"], 
   Visible -> False];
sel = NotebookFind[nb, "Input", All, CellStyle];
in = NotebookRead[nb];
NotebookClose[nb]
textureBoxes = 
  DeleteDuplicates@Cases[in, RowBox[{"Texture", __}], Infinity];
docsTextures = Check[
      ReleaseHold[#], Sow[#, "Error"]; Nothing
      ] &@MakeExpression[#, StandardForm] & /@
  DeleteCases[textureBoxes, _?(FreeQ[#, RasterBox] &)]

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks a lot! Some of the images are already a part of the ExampleData like Graphics[ExampleData[{"ColorTexture", #}]] & /@ {"Kingwood", "GloriesPattern", "DelisPattern", "FleurPattern"}. I wonder if other images are also part of them. $\endgroup$
    – codebpr
    Feb 21 at 16:50
  • $\begingroup$ @codebpr You're welcome. They aren't exactly the same: the ExampleData images have a higher resolution and sometimes a slightly different aspect ratio, it seems. Since, ExampleData /@ ExampleData["ColorTexture"] shows all the color textures, it's not hard to compare them to see if the other images occur. $\endgroup$
    – Goofy
    Feb 21 at 18:18
  • $\begingroup$ Yes, you are right. Also, the other images don't appear in ExampleData["ColorTexture"]. Maybe they are part of some other ExampleData. $\endgroup$
    – codebpr
    Feb 21 at 18:23
  • 1
    $\begingroup$ @codebpr Maybe. I'm pretty sure they don't occur in the data collections listed when you execute ExampleData[]. Maybe they're somewhere else. I had a student once who used a drawing program to make textures she used to decorate her graphs in multivariable calculus. I rather think whoever wrote the docs, just made up some and pasted them in the input, thinking they were nothing special. $\endgroup$
    – Goofy
    Feb 21 at 19:09
3
$\begingroup$

This is the original code of the first texture image:

\!\(\*GraphicsBox[TagBox[RasterBox[CompressedData["
1:eJzt3E+PTmcYwOE27Tdg1U2xGRHFbA0WbEhUO2qwFCHRmUj/UCqW9Ql8B2V0
JPbSNpEoaTQaElbYmBkzETGf4OlznyHpwpuMzrx1zntfkiuzm5zbc/+ec2ys
PfrN/qMffVD/fLjo4/rj0/VfFQAAAAAAAAAAAAAAAAAAAAAAAAAAAACgO9ZU
69bvL2urdUBPbxpZ04JuV6r9T4YOlFVDB8vqobHqINDTWNNKNNP1O+BN+zs2
7i3jwzvLsS27ynGgp2gkWolmun4HxHdM3GUxz8PtG8qdbZvKn9s+A3qIRqKV
aCbaiYbed8fL6T++aeJOu13nujEyXH4d2QL0EI1EK9HM6gHpP75r4m6L+X4f
2Qz0EI1EK8f1D+noH/LSP+Slf8hL/5CX/iEv/UNe+oe89A956R/y0j/kpX/I
S/+Ql/4hL/1DXvqHvPQPeekf8tI/5KV/yEv/kJf+l2Hr5vLb1k3QN7Fj+m9f
/3E2j47sKk8n9pTHJ3aXx1/DCqo7FbsVO9bcA/pvXf9P6vnMnR8ts2e/LLM/
wgqqOxW7FTum/3b2H/d0nNP0qS/K9GlYQXWnYrdix/Tf4v7rXd2c1w+wgupO
xW7pX/8kpH/9k5f+9U9e+tc/eelf/+Slf/2Tl/71T1761z956V//5KV//ZOX
/vVPXvrXP3npX//kpX/9k5f+9U9e+tc/eelf/+Slf/2Tl/71T1761/8bZ2gl
/bfKQPZff/ez7z+nhfp97vpP3v/pfWXm3Gh5/tPh6hCtcrg5mzgj/bfDQPV/
ZvG9//zCofLq+qnyauq78uoarRBnUc8kzqb5DujHvwX0r//ov75rmn27+i1t
Us8kzkb/7TGw/V973f8vtEKcxTX9t43+0b/+9Y/+9a9/9K9//aN//esf/etf
/+hf//pH//rXP/rXv/7Rv/71j/67R//oX//6R//61z/617/+0b/+9Y/+9a9/
9K9//aN//esf/etf/+hf//pH/92j/+V4/f9aD4KYRf/61//STZ4sC5fHy8KV
ifqzo5pnH29m0b/+9b8E8b6svby4ebHM379a5u9dKvN//9xN8ex1hpiluQOm
+vQdoP9W0v9/6z/enfP3J8v0ywdlZu5umZn/q5vqs8cMMUvMpH/963+J/dd3
Z/Qz++xWmZ3+o5vqs8cMMYv+9a//d+i/fj/HO7TpaOZ2N9VnjxliFv3rX//6
17/+9a9//etf//rXv/71r3/961//+te//vWvf/3rX//617/+9d+ClvWvf/3r
X//617/+9a9//etf//rXv/71r3/961//+te//vWvf/3rX//617/+9a9//etf
//rXv/71r3/961//+te//vWvf/3rX//617/+9a9//etf/++9Y/3rX//617/+
9a9//etf//rXv/71r3/961//+te//vWvf/3rX//617/+9a9//etf//rXv/71
r3/961//+te//vWvf/3rX//617/+9a9//etf//rXv/71r3/9t6Bl/etf//rX
v/71r3/961//+te//vWvf/3rX//617/+9b/8/u9dKjNzd8vss1uLd0AX1WeP
GWIW/etf/+/Q//3JMv3yQdNPvEM7qT57zBCz6F//+l+K2v/kyfLi5sXazdXm
3Rnfz50Uz15niFlipphN//rX/xLUXhYuj5eFKxPNu7OTmmcfb2bp69+V/ltJ
/8v7Dmi+lwdBv977+m81/fO/0H8r6R/961//6F//+kf/+tc/+te//tG//vWP
/vWvf/Svf/2jf/3rH/3rX//ov3v0j/71r3/0r3/9o3/96x/961//6F//+kf/
+tc/+te//tG//vWP/vWvf/TfPQPb/9Tr/mmPKf23zUD2f6H2f/3U4h1wjVaI
s6hnEmej//YYqP6bHdhXZs6N1vfM4eZdQ5scbs4mzqg/Z6//9P2/3oN4x9A+
/T53/eu/cYZW6ueZ61//5KV//ZOX/vVPXvrXP3npX//kpX/9k5f+9U9e+tc/
eelf/+Slf/2Tl/71T1761z956V//5KV//ZOX/vVPXvrXP3npX//kpX/9k5f+
9U9e+tc/eem/G/2frf2fWjwvWDF1p2K39N/e/p9M7Clz50ebc4q7GlZM3anY
rdgx/bez/0dHdpWn9Xwen9jd3NOwYupOxW7Fjum/ff03ti7eA9AvsWP93GH9
Q176h7z0D3npH/LSP+Slf8hL/5CX/iEv/UNe+oe89A956R/y0j/kpX/IS/+Q
l/4hL/1DXvqHvPQPeekf8tI/5KV/yGsQ+z9WZ7m9bVO5MTLczAe8XTQSrRwb
kP5X1RnGh3eWh9s3lDt1rrjbgLeLRqKVaGZVx/tfU32y/kDZsXFvM0/caceB
nqKRaCWaiXbWtKDjZd8BQweau2z10FjzTQP0Mta0Es10vf1/3wHxHbO2Wgf0
9KaRQWkfAAAAAAAAAAAAAAAAAAAAAAAAAAAAADL5B8e4A6I=
"], {{0, 256.}, {256., 0}}, {0, 255}, ColorFunction -> RGBColor, 
      ImageResolution -> {72, 72}], 
     BoxForm`ImageTag["Byte", ColorSpace -> "RGB", 
      Interleaving -> True], Selectable -> False], 
    DefaultBaseStyle -> "ImageGraphics", 
    ImageSize -> {30.7578125, Automatic}, 
    ImageSizeRaw -> {256., 256.}, 
    PlotRange -> {{0, 256.}, {0, 256.}}]\)

enter image description here

Or in more understandable form:

data = CompressedData["
1:eJzt3E+PTmcYwOE27Tdg1U2xGRHFbA0WbEhUO2qwFCHRmUj/UCqW9Ql8B2V0
JPbSNpEoaTQaElbYmBkzETGf4OlznyHpwpuMzrx1zntfkiuzm5zbc/+ec2ys
PfrN/qMffVD/fLjo4/rj0/VfFQAAAAAAAAAAAAAAAAAAAAAAAAAAAACgO9ZU
69bvL2urdUBPbxpZ04JuV6r9T4YOlFVDB8vqobHqINDTWNNKNNP1O+BN+zs2
7i3jwzvLsS27ynGgp2gkWolmun4HxHdM3GUxz8PtG8qdbZvKn9s+A3qIRqKV
aCbaiYbed8fL6T++aeJOu13nujEyXH4d2QL0EI1EK9HM6gHpP75r4m6L+X4f
2Qz0EI1EK8f1D+noH/LSP+Slf8hL/5CX/iEv/UNe+oe89A956R/y0j/kpX/I
S/+Ql/4hL/1DXvqHvPQPeekf8tI/5KV/yEv/kJf+l2Hr5vLb1k3QN7Fj+m9f
/3E2j47sKk8n9pTHJ3aXx1/DCqo7FbsVO9bcA/pvXf9P6vnMnR8ts2e/LLM/
wgqqOxW7FTum/3b2H/d0nNP0qS/K9GlYQXWnYrdix/Tf4v7rXd2c1w+wgupO
xW7pX/8kpH/9k5f+9U9e+tc/eelf/+Slf/2Tl/71T1761z956V//5KV//ZOX
/vVPXvrXP3npX//kpX/9k5f+9U9e+tc/eelf/+Slf/2Tl/71T1761/8bZ2gl
/bfKQPZff/ez7z+nhfp97vpP3v/pfWXm3Gh5/tPh6hCtcrg5mzgj/bfDQPV/
ZvG9//zCofLq+qnyauq78uoarRBnUc8kzqb5DujHvwX0r//ov75rmn27+i1t
Us8kzkb/7TGw/V973f8vtEKcxTX9t43+0b/+9Y/+9a9/9K9//aN//esf/etf
/+hf//pH//rXP/rXv/7Rv/71j/67R//oX//6R//61z/617/+0b/+9Y/+9a9/
9K9//aN//esf/etf/+hf//pH/92j/+V4/f9aD4KYRf/61//STZ4sC5fHy8KV
ifqzo5pnH29m0b/+9b8E8b6svby4ebHM379a5u9dKvN//9xN8ex1hpiluQOm
+vQdoP9W0v9/6z/enfP3J8v0ywdlZu5umZn/q5vqs8cMMUvMpH/963+J/dd3
Z/Qz++xWmZ3+o5vqs8cMMYv+9a//d+i/fj/HO7TpaOZ2N9VnjxliFv3rX//6
17/+9a9//etf//rXv/71r3/961//+te//vWvf/3rX//617/+9d+ClvWvf/3r
X//617/+9a9//etf//rXv/71r3/961//+te//vWvf/3rX//617/+9a9//etf
//rXv/71r3/961//+te//vWvf/3rX//617/+9a9//etf/++9Y/3rX//617/+
9a9//etf//rXv/71r3/961//+te//vWvf/3rX//617/+9a9//etf//rXv/71
r3/961//+te//vWvf/3rX//617/+9a9//etf//rXv/71r3/9t6Bl/etf//rX
v/71r3/961//+te//vWvf/3rX//617/+9b/8/u9dKjNzd8vss1uLd0AX1WeP
GWIW/etf/+/Q//3JMv3yQdNPvEM7qT57zBCz6F//+l+K2v/kyfLi5sXazdXm
3Rnfz50Uz15niFlipphN//rX/xLUXhYuj5eFKxPNu7OTmmcfb2bp69+V/ltJ
/8v7Dmi+lwdBv977+m81/fO/0H8r6R/961//6F//+kf/+tc/+te//tG//vWP
/vWvf/Svf/2jf/3rH/3rX//ov3v0j/71r3/0r3/9o3/96x/961//6F//+kf/
+tc/+te//tG//vWP/vWvf/TfPQPb/9Tr/mmPKf23zUD2f6H2f/3U4h1wjVaI
s6hnEmej//YYqP6bHdhXZs6N1vfM4eZdQ5scbs4mzqg/Z6//9P2/3oN4x9A+
/T53/eu/cYZW6ueZ61//5KV//ZOX/vVPXvrXP3npX//kpX/9k5f+9U9e+tc/
eelf/+Slf/2Tl/71T1761z956V//5KV//ZOX/vVPXvrXP3npX//kpX/9k5f+
9U9e+tc/eem/G/2frf2fWjwvWDF1p2K39N/e/p9M7Clz50ebc4q7GlZM3anY
rdgx/bez/0dHdpWn9Xwen9jd3NOwYupOxW7Fjum/ff03ti7eA9AvsWP93GH9
Q176h7z0D3npH/LSP+Slf8hL/5CX/iEv/UNe+oe89A956R/y0j/kpX/IS/+Q
l/4hL/1DXvqHvPQPeekf8tI/5KV/yGsQ+z9WZ7m9bVO5MTLczAe8XTQSrRwb
kP5X1RnGh3eWh9s3lDt1rrjbgLeLRqKVaGZVx/tfU32y/kDZsXFvM0/caceB
nqKRaCWaiXbWtKDjZd8BQweau2z10FjzTQP0Mta0Es10vf1/3wHxHbO2Wgf0
9KaRQWkfAAAAAAAAAAAAAAAAAAAAAAAAAAAAADL5B8e4A6I=
"];

Image[data, "Byte", ColorSpace -> "RGB"]
(*or Image[Map[RGBColor, data/255., {2}]] *)

enter image description here

$\endgroup$
2
  • $\begingroup$ That's what I got when I copy-pasted the example code in StackExchange. Can I get the source directly from MMA itself? $\endgroup$
    – codebpr
    Feb 21 at 14:16
  • 1
    $\begingroup$ @codebpr: You can get it from the help file. $\endgroup$ Feb 21 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.