# Output a 10*10 random color matrix withJPEG form in Cloud Application

I want to output 100 JPEG Images(in 10 * 10 matrix) in Cloud Application. I came to this code:

ExportForm[
Grid[Partition[ExportForm[#, "JPEG"] & /@ RandomColor[100],
10]], "HTML"]


And deploy:

CloudDeploy[
ExportForm[
Grid[Partition[ExportForm[#, "JPEG"] & /@ RandomColor[100], 10]],
"HTML"], Permissions -> "Public"]


Get cloud object:

CloudObject["https://www.wolframcloud.com/objects/da4b2681-15f7-4668-9cf2-31d84e4c0634"]


But it gives awkward text:

Question:

1. Why my code failed to output 10*10 random color matrix?
2. How to fix it?
• Setup a GraphicsGrid expression that gives the desired "10*10 matrix" on the desktop. The deployed graphic should then display without having to wrap it in ExportForm HTML. – Christopher Haydock Jan 15 '16 at 1:29
• @ChristopherHaydock CloudDeploy[ExportForm[GraphicsGrid[Partition[RandomColor[100], 10]], "HTML"], Permissions -> "Public"]:wolframcloud.com/objects/396e974a-24f8-4fd1-9834-1718e0959ca2, but only generate 1 image. BTW, Grid gives correct result in my desktop MMA. – Sayakiss Jan 15 '16 at 1:37
• A Grid that works on your desktop may still fail when deployed. But a GraphicsGrid that works on your desktop will probably also work in the cloud. – Christopher Haydock Jan 15 '16 at 2:00
• Instead of a simple GraphicsGrid it is also possible to deploy an HTML page with a 10 by 10 table of 100 images. Is that what you must have? Or do you want a Grid that is generated by the Mathematica online application? – Christopher Haydock Jan 15 '16 at 20:24
• @ChristopherHaydock I want to deploy a application which display n*n images. Basically, I want HTML page with a 10 by 10 table of 100 images this. – Sayakiss Jan 16 '16 at 4:25

GraphicsGrid cloud object:

CloudDeploy[Delayed[
ExportForm[With[{dimension = 4, pixels = 32},
GraphicsGrid[
Table[Image[RandomColor[]], {dimension}, {dimension}],
Spacings -> 0, ImageSize -> dimension*pixels]],
"HTML"]],
FileNameJoin[{$CloudRootDirectory, "RandomColorGraphicsGrid"}]]  A much less efficient Grid cloud object that displays a lot of separate images: CloudDeploy[Delayed[ ExportForm[With[{dimension = 4, pixels = 32}, Grid[ Table[ Image[Table[#, {pixels}, {pixels}] &[RandomColor[]]], {dimension}, {dimension}]]], "HTML"]], FileNameJoin[{$CloudRootDirectory, "RandomColorGrid"}]]


In either case the Delayed gives a new random color set with each call to the cloud object.

• Cool. What I want is a lot of separate images, and the second code segment works well for me. Really thanks and sorry for late reply! – Sayakiss Jan 19 '16 at 14:43
• I read the document about Delayed, but I did't catch the point why you add a Delayed here. Could you please explain why you add Delayed to your cloud application? -- Okay, I see, without Delayed it will evaluate once and every time I call remains a same picture(not random one). – Sayakiss Jan 19 '16 at 14:47
• Thanks for helping improve this answer! – Christopher Haydock Jan 19 '16 at 15:17