I want to create an image with dynamic size like placeholder.com, below is the code to create image with golang:
width = 350
height = 150
img := image.NewRGBA(image.Rect(0, 0, width, height))
for x := 0; x < width; x++ {
for y := 0; y < height; y++ {
img.Set(x, y, color.RGBA{204, 204, 204, 1})
}
}
Result:
But I want to draw the width x height
the same as bellow:
I have researched but the results did not match my requirement. For example, this solution only draw text with fixed size and the text does not look sharp.