Message Boards Message Boards

0
|
10242 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to Export a Table as an Image?

Posted 10 years ago

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!

POSTED BY: Greg
4 Replies

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]]
POSTED BY: Marco Thiel
Posted 10 years ago

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.

Attachments:
POSTED BY: Greg

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]
POSTED BY: Sam Carrettie
Posted 10 years ago

It does, yes. Sorry I missed that. I tested it and it works perfectly. Thanks for pointing it out.

POSTED BY: Greg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract