My goal is to generate big graphs and save images of them (PNG, preferably) through a script (that is: without having to interact with them through a notebook).
Example: I generate a complete graph on 100 notes in a Mathematica notebook and saved the graphic. Out comes the wonderfully detailed image below:
But when I save it via script as below:
graph = CompleteGraph[100];
Export["mysuperawesomegraph.png", ImageResize[graph, 1000]];
Oh no! So much quality is lost! You can't even see the edges anymore...
I've tried changing the number 1000 to numbers up to 15000 in the line:
Export["mysuperawesomegraph.png", ImageResize[graph, 1000]];
The result seems to be that a bigger image is saved, but with the same level of detail.
You first want to find the good size on screen. This looks good: Show[graph, ImageSize -> 1000]
Then export specifying a proper image resolution:
Export["mysuperawesomegraph.png",
Show[graph, ImageSize -> 1000], ImageResolution -> 200]
For more details, check out this question on mathematica.SE
Try this:
Export["mysuperawesomegraph.png", CompleteGraph[100, ImageSize -> 1000]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With