How to create a smooth black and white texture without jaggies?
Here's another option using Rasterize
.
SeedRandom[1234];
img = Binarize[
Blur[ListDensityPlot[randomTiles, InterpolationOrder -> 0,
Frame -> False, PlotRangePadding -> 0,
ImageSize -> {1600, 1600}], 40]];
rimg = Rasterize[img, RasterSize -> 400, ImageSize -> 400]
ImageDimensions[rimg]
- Use
ColorFunction -> Graylevel
inListDensityPlot
to start from a black and white image, avoidingBinarize
altogether. - ask for a much higher number of pixels in your image with
ImageSize
; that alone causes considerable smoothing when you downsize the image; - for further effect, apply e.g.
MedianFilter
with an appropriate parameter.
SeedRandom[1234]
randomTiles =
Table[{RandomReal[], RandomReal[], RandomInteger[{0, 1}]}, {n, 1, 1000}];
MedianFilter[#, 5] &@
ListDensityPlot[
randomTiles,
InterpolationOrder -> 0, Frame -> False,
PlotRangePadding -> 0, ImageSize -> {1000, 1000},
ColorFunction -> GrayLevel
]