Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Exporting images without white borders

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75297] Re: Exporting images without white borders
  • From: "Steven T. Hatton" <hattons at globalsymmetry.com>
  • Date: Tue, 24 Apr 2007 03:25:58 -0400 (EDT)
  • References: <f0hunk$a3b$1@smc.vnet.net> <462CDE15.5050108@gmail.com>

On Monday 23 April 2007 12:25, Jean-Marc Gulliet wrote:
> Steven T. Hatton wrote:
> [snip]

> Could you, please post the correct code for each case? It occurs that
> both sets of expressions are identical. Also, the variable cntr is not
> used. What was its purpose, if any?

The cntr was superfluous to the example.  I neglected to delete it when I took 
out the related code.  The examples /are/ different.  One has 

Graphics[img[[1]],...

The other has 

Graphics[{img[[1]]},...

And, yes, the '{''}' make a difference in the result.  I have now discovered 
that the image size also has a bearing on the result.  Here is the exact file 
I used to produce the results:

SetDirectory[dn = "~/test"];
img = Import[dn <> "/test-in.jpg"];

(*no border*)
Export["test-out-1.jpg"
  ,  Graphics[img[[1]]
    , AspectRatio -> Automatic
    , PlotRange -> {{0, 640}, {0, 480}}
  ]
  ,ImageSize->{640,480}
]

(*1-pixel border at bottom and right*)
Export["test-out-2.jpg"
  ,  Graphics[{img[[1]]}
    , AspectRatio -> Automatic
    , PlotRange -> {{0, 640}, {0, 480}}
  ]
  ,ImageSize->{640,480}
]

If I take out the ,ImageSize->{640,480} the result is that _both_ output 
images have borders on the bottom, right and top edges.


  • Prev by Date: Re: Optimisation of FourierCoefficients
  • Next by Date: Re: question
  • Previous by thread: Exporting images without white borders
  • Next by thread: Re: Exporting images without white borders