Message Boards Message Boards

4 Replies
2 Total Likes
View groups...
Share this post:

How can we export a graphic without the border?

Posted 11 years ago
I have been using Mathematica to generate test images. The images are designed to have a specific dimension and resolution. What I want is for the graphic as designed to be exactly exported as a tiff or jpeg conmpletely filling the designed-for size. Unfortunately, Mathematica wants to add a border to everything, so when the image is exported at the intended size, it includes this unwanted border, and the dimensions in pixels of the internal components have been altered.

Does anyone know how to eliminate this border?  Note that just chopping it off does not work because including it in the export already re-rasterized the image, so the internal components have changed in unspecified ways.

POSTED BY: David Keith
4 Replies
Posted 11 years ago
Yes -- That worked. Thanks very much!
POSTED BY: David Keith
Try adding PlotRangePAdding -> 0 to your code.
POSTED BY: C ormullion
Posted 11 years ago
David, what format are you trying to export? 
data = RandomVariate[NormalDistribution[4, 0.5], 1000];
Histogram[data, Automatic, "Probability",

PlotLabel -> "Just an Example"]
Export["example.png", %]

has no border on my machine running MMA 9
POSTED BY: Diego Zviovich
Posted 11 years ago
Hi Diego,
My graphic is built explicitly of primities. It might be for example a filled rectange of a certan size. Here is a screen clip from it's appearance in the notebook when the graphic is selected. The largest extent of the defined graphic is the dark background, but it's grown a border.

When this is exported as a TIFF and then imported into Photoshop we get this. The gray is the Photoshop window background. The white border was exported by Mathematica as part of the image. It was added gratuitously and is unwanted.

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

Group Abstract Group Abstract