MathGroup Archive 2009

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

Search the Archive

Trouble controlling Rasterize -- it introduces unwanted borders

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102134] Trouble controlling Rasterize -- it introduces unwanted borders
  • From: Damon <damonwischik at gmail.com>
  • Date: Thu, 30 Jul 2009 05:33:16 -0400 (EDT)

I can't work out how to eliminate spurious borders in Rasterize. In
the following code, I create a simple graphic (a line from {0,0} to
{1,1}) with the plot range {{0,1},{0,1}}. I want to rasterize it to be
6 pixels high, and I want the rasterized version to occupy exactly the
same plot range as the original. But the Rasterize[] operation
introduces an unwanted border (shown in yellow in the code below), and
when I try to use Inset to specify the coordinate range of the
rasterized graphic then I end up with another unwanted border (show in
red in the code below).

I would be grateful for help in understanding where these borders come
from and how to eliminate them.

g = Graphics[{AbsoluteThickness[20], Line[{{0, 0}, {1, 1}}]},
   Background -> Cyan, PlotRange -> {{0, 1}, {0, 1}},
   ImageSize -> 150];
gr = Rasterize[g, RasterSize -> {{Infinity}, {6}},
   Background -> Yellow];
gri = Graphics[Inset[gr, {0, 0}, {0, 0}, {1, 1}, Background -> Red]];
Show[gri, Frame -> True]


  • Prev by Date: Re: ViewVector->{0,0,0}
  • Next by Date: Re: Re: How can I "perturbate" a NDSolve
  • Previous by thread: Re: A simple error
  • Next by thread: Multiplication of matrices