lgmendes
(Luis Mendes)
August 1, 2018, 4:06pm
1
Dear all,
I want to convert a Graphic type variable into an image. For example, I’m trying the following code to convert a simple graphics,
{PointSize[Small], Point[{1, 1}], Point[{0, 0}]} //Graphics[#, ImageSize -> {512, 512}] & // ColorNegate
The problem is that the two points are not really in the corner of the image. How can I fix the problem?
Please note that this example is a toy example.
Thank you,
Luis
kmartin
(Kyle Martin)
August 1, 2018, 4:16pm
2
I think specifying the proper PlotRange explicitly may get you what you’re after:
Graphics[{PointSize[Small], Point[{1, 1}], Point[{0, 0}]},
ImageSize -> {25, 25}, PlotRange -> {{0, 1}, {0, 1}}] // ColorNegate
The default value of PlotRange seems to add a little extra “padding” past the outermost points, which in other cases would be desirable.
(I changed the ImageSize to make it more clear where the points were ending up)