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.
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
Hello,
The simplest solution is:
n=100;
Image[Graphics[Rectangle[{0, 0}, {1, 1}],
PlotRange -> {{0, 2}, {0, 2}}, ImageSize -> {n, n}]]
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...@informatik.uni-leipzig.de>
wrote:
> Hi,
>
> With[{n = 100},
> img = Rasterize[
> Graphics[Rectangle[{0, 0}, {1, 1}], PlotRange -> {{0, 2}, {0, 2}}=