MathGroup Archive 2009

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

Search the Archive

Re: Rasterize off by one pixel

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100563] Re: Rasterize off by one pixel
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Mon, 8 Jun 2009 02:06:08 -0400 (EDT)
  • References: <h0btdg$8g7$1@smc.vnet.net> <h0d709$sr5$1@smc.vnet.net>

For n<15 this has still problems. See this plot:

DiscretePlot[
 img = Rasterize[
    Graphics[Rectangle[{0, 0}, {1, 1}], PlotRange -> {{0, 1}, {0, 1}},
      PlotRangePadding -> None, AspectRatio -> Automatic,
     ImagePadding -> None], "Image", ImageSize -> {n, n}] //
   ImageDimensions, {n, 100}]

Cheers -- Sjoerd

On Jun 6, 9:48 am, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de>
wrote:
> Hi,
>
> With[{n = 100},
>   img = Rasterize[
>     Graphics[Rectangle[{0, 0}, {1, 1}], PlotRange -> {{0, 2}, {0, 2}}=
,
>      PlotRangePadding -> None, AspectRatio -> Automatic,
>      ImagePadding -> None], "Image", ImageSize -> {n, n}]
>   ]
>
> ?
>
> Regards
>     Jens
>
> swiftset wrote:
> > I'm trying to make a 100x100 pixel image using Rasterize, as follows,
> > where n=100
>
> > Rasterize[
> >   Graphics[Rectangle[{0,0}, {1,1}],
> >                 PlotRange->{{0,2},{0,2}}],
> >   "Image",
> >    RasterSize->{n,n}
> > ]
>
> > when I check the resulting image using ImageDimensions, the size is
> > 100x101. If I say size {n,n/2}, then the image is 100x51 instead of
> > 100x50.
>
> > Any ideas what causes this and how to fix it? Thanks.



  • Prev by Date: Re: Mathematica bug??
  • Next by Date: Re: Mathematica bug??
  • Previous by thread: Re: Rasterize off by one pixel
  • Next by thread: Problem with a plot in Mathematica