SetDirectory["C:/drorbn/AcademicPensieve/2009-02/"];
<< KnotTheory`

Switch[Online,
Online, ideal=Import["http://katlas.org/w/images/5/5a/IdealLinks.txt.gz", "String"],
Offline, ideal=Import["C:\\drorbn\\People\\Gilbert\\idealLinks.txt", "String"]
]

Length[
data=Cases[ImportString[ideal, "XML"], XMLElement["HL", hl___] :> HL[hl], Infinity]
]

ProcessHL[hl_HL] := Module[
{Id, CS, L, strands, rls, ips, coeffs},
{Id, CS} = {"Id", "Conway"} /. hl[[1]];
L=Link[Id];
ConwayString[L] = CS;
strands = Cases[hl, XMLElement["STRING", s___] :> Strand[s], Infinity];
rls=ips={};
(
rl = ToExpression["L" /. #[[1]]];
ip=FourierData @@ #[[2]] /. XMLElement["Coeff", l_List, {}] :> {
ToExpression["I" /. l],
ToExpression["{"<>("A" /. l)<>"}"],
ToExpression["{"<>("B" /. l)<>"}"]
};
AppendTo[rls, rl];
AppendTo[ips, ip]
)& /@ strands;
RopeLength[L] = rls;
IdealPresentationData[L] = ips;
L
];
IdealPresentation[L_Link][t_] :=IdealPresentationData[L] /. {
{i_,A_List,B_List} :>  If[i==0, 1/2 A Cos[i t], A Cos[i t] + B Sin[i t]]
} /. FourierData -> Plus

Ls = Union[ProcessHL /@ data];

Max[RopeLength /@ Ls]

l=Length[Ls]

Clear[DrawLink];
RandomUnitVector[] := (
v={Random[], Random[], Random[]};
v/Sqrt[v.v]
);
RandomColor[] := RGBColor@@RandomUnitVector[];
DrawLink[L_Link] := DrawLink[L] = ImageCrop[Rasterize[
Graphics3D[
nc=Length[RopeLength[L]];
basehue=Random[];
Table[
{
Specularity[0.7, 40Random[]],
Hue[basehue+c/nc],
Glow[Hue[basehue+c/nc, 1, 0.25]],
{X1,X2,X3}= Compile[{t}, #]& /@ IdealPresentation[L][t][[c]];
T =8RopeLength[L][[c]];
Tube[Table[{X1[2Pi k/T], X2[2Pi k/T], X3[2Pi k/T]}, {k, 0, T}], 0.1+0.4Random[]]
},
{c,nc}
],
Boxed -> False, Background -> Black, ImagePadding->None,
PlotRangePadding->0,
ViewPoint -> 20 RandomUnitVector[],
Lighting -> {
{"Directional", Hue[Random[]],RandomUnitVector[]},
{"Point", Hue[1], 3Random[]RandomUnitVector[]}
}
],
 ImageSize -> 400, RasterSize -> 400, Background -> Black
]];

SeedRandom[1]; scale=250; textsize=Round[13scale/72/2];
im=ImageAssemble[{
{Rasterize[GraphicsGrid[
Partition[DrawLink /@ Ls, 13],
Background -> Black, Spacings -> 0
], ImageSize -> scale{13, 10}, RasterSize -> scale{13, 10}, Background -> Black]},
{
Rasterize[
Graphics[{Yellow, Text[Style[
Column[{
"Loop Soup by Dror Bar-Natan (2009) based on data by Brian Gilbert; http://www.math.toronto.edu/~drorbn/Gallery/KnottedObjects/LoopSoup/",
"(technically, these are minimal rope-length presentations of all prime links with up to 9 crossings)"
}, Center
], textsize
]]}],
ImageSize -> {13scale, 3textsize}, RasterSize -> {13scale, 3textsize}, Background -> Black
]
}
}];
Show[ImageResize[im, 720]]

Export["LoopSoup.png", im];
Export["LoopSoup_720.png", ImageResize[im, 720]];
Export["LoopSoup_120.png", ImageResize[ImageTake[im, 250*3, 250*4], 120]];

textsize

textsize=Round[13scale/72/2];
Rasterize[
Graphics[{Yellow, Text[Style[
Column[{
"Loop Soup by Dror Bar-Natan (2009) based on data by Brian Gilbert; http://www.math.toronto.edu/~drorbn/Gallery/KnottedObjects/LoopSoup/",
"(technically, these are minimal rope-length presentations of all prime links with up to 9 crossings)"
}, Center
], textsize
]]}],
ImageSize ->{13scale, 3textsize},  RasterSize -> {13scale, 3textsize}, Background -> Black
]

{13scale, 3textsize}

135/3250 // N

30/720 // N