How might I export a table (or data as a Grid) in an image file? Question arose as I tried to automate a result. I have export of a PNG file working fine for a plot. Thanks!
Hi Greg,
what about:
Export["~/Desktop/test.png", TableForm[RandomReal[1, {10, 2}]]]
for png and
Export["~/Desktop/test.jpg", TableForm[RandomReal[1, {10, 2}]]]
for jpg?
If you want the frame, too, this might work:
Export["~/Desktop/test.png", Grid[RandomReal[1, {10, 2}], Frame -> All]]
Cheers,
M.
PS: You can improve the resolution:
Export["~/Desktop/test.jpg", Magnify[TableForm[RandomReal[1, {10, 2}]], 5]]
Great for images. I attached a couple of documents to clarify what’s going on here. It’s actually a CSV (e.g. “//TableForm”) that I’d like to export as an image if possible.
So Marco’s first line of code exactly answers your question? Just modify via a variable:
tbl = TableForm[Import["/Users/Greg/Downloads/data.csv", "CSV"]];
Export["tbl.png", tbl]
It does, yes. Sorry I missed that. I tested it and it works perfectly. Thanks for pointing it out.