In[]:=
Clear["Global*`"]
In[]:=
BeginPackage["ImageFromNumber`"]ImageFromNumber::usage="ImageFromNumber[pixelsHigh_, pixelsWide_, pixelsDeep_, pixelSequence_, colorSequence_, numberToBeImaged_, zoomLevel_] gives a 2D image corresponding to the number to be imaged of high x wide, assuming right-to-left-top-to-bottom pixel sequencing, white-then-black color sequencing, with zoom levels available for tiny images. Numbers too large for the high, wide, deep and color limits wrap around, effectively modulo 2^(high x wide x deep)."Begin["`Private`"]ImageFromNumber[pixelsHigh_,pixelsWide_,pixelsDeep_,pixelSequence_,colorSequence_,numberToBeImaged_,zoomLevel_]:=(colorValues=IntegerDigits[numberToBeImaged,Length[colorSequence],Max[pixelsHigh,1]*Max[pixelsWide,1]*Max[pixelsDeep,1]]/.colorSequence;Graphics[Raster[Table[colorValues[[(((i-1)*pixelsWide)+j)]],{i,pixelsHigh},{j,pixelsWide}],ColorFunction->(RGBColor[#]&)],Frame->False,FrameTicks->False,Axes->False,ImageSize->Times[pixelsHigh,zoomLevel]]);End[];EndPackage[];
Out[]=
ImageFromNumber`
Out[]=
ImageFromNumber[pixelsHigh_, pixelsWide_, pixelsDeep_, pixelSequence_, colorSequence_, numberToBeImaged_, zoomLevel_] gives a 2D image corresponding to the number to be imaged of high x wide, assuming right-to-left-top-to-bottom pixel sequencing, white-then-black color sequencing, with zoom levels available for tiny images. Numbers too large for the high, wide, deep and color limits wrap around, effectively modulo 2^(high x wide x deep).
Out[]=
ImageFromNumber`Private`
In[]:=
tilE={#,ImageFromNumber[5,6,0,1,{0->"#ffffff",1"#000000"},#,20]}&/@RandomInteger[{0,-1+2^30},20]
Out[]=
946968686,
,485184348,
,173747834,
,332803780,
,649362788,
,471789304,
,691373449,
,627318105,
,1051878916,
,645329176,
,116073356,
,583634044,
,320672059,
,262557344,
,1055540283,
,591134530,
,896549041,
,1031107339,
,327141594,
,284018738,
In[]:=
tNum=1For[t=tNum,t<tNum+19,t++,Print["Tile number: ",GraphicsGrid[Table[tilE[[t]][[2]],{i,1,20},{j,1,20}],Spacings0,FrameAll,FrameStyleDirective[GrayLevel[0.9],Thin]]]]
Out[]=
1
Tile number:
Tile number:
Tile number:
Tile number: