I tried something small first, to get a feeling about this. So I defined a Rectangle[]
, placed it in a corner of Graphics[PlotRange->{...}]
and defined an ImageSize
. After applying Binarize[]
and ImageData[]
consecutively, I got an array of data. Perfect so far, but:
- The dimension of the data does not equal the dimensions of
ImageSize[]
, why? - Why aren't the rows filled with 0 directly positioned at the edge, as the
Rectangle[]
is supposed to be positioned in the corner?
My example:
periode = 10;
length = 5;
height = 2;
rect = Rectangle[{0, 0}, {length, height}];
gr = Graphics[rect, PlotRangePadding -> 0,
PlotRange -> {{0, periode}, {0, periode}},
ImageSize -> {periode, periode}]
data = ImageData[Binarize[gr]]
Dimensions[data]
The result looks like this:
BoxMatrix
or I misunderstand your purpose? $\endgroup$BoxMatrix
. However, for arbitrary shaped graphics, which I have in mind (e.g. ring, star, whatever) the command won't be useful, wouldn't it be? $\endgroup$