Re: Rasterize off by one pixel
- To: mathgroup at smc.vnet.net
- Subject: [mg100546] Re: Rasterize off by one pixel
- From: lehin.p at gmail.com
- Date: Sun, 7 Jun 2009 05:03:22 -0400 (EDT)
- References: <h0btdg$8g7$1@smc.vnet.net>
On 5 =C9=C0=CE, 23:58, swiftset <swift... at gmail.com> 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. Hello, The simplest solution is: n=100; Image[Graphics[Rectangle[{0, 0}, {1, 1}], PlotRange -> {{0, 2}, {0, 2}}, ImageSize -> {n, n}]]