How to draw transparent lines on an image using PIL?


Retric

Here is what I get:

draw.line([(x1,y1),(x2,y2)],fill = (255, 255, 255))

The result is a white line, but I want a transparent line, what should I do?

Kay Patel

As far as I know, the line function takes RGB or RGBA values.

try:

draw.line([(x1,y1),(x2,y2)],fill = (255, 255, 255, 0))

Related


How to merge a transparent png image with another image using PIL

Arackna: I have a transparent png image "foo.png" and use im = Image.open("foo2.png"); Now I need to merge foo.png with foo2.png. (foo.png contains some text, I want to print that text on foo2.png) Nosklo : import Image background = Image.open("test1.png") f

How to draw transparent lines on an image using PIL?

Retric Here is what I get: draw.line([(x1,y1),(x2,y2)],fill = (255, 255, 255)) The result is a white line, but I want a transparent line, what should I do? Kay Patel As far as I know, the line function takes RGB or RGBA values. try: draw.line([(x1,y1),(x2,y2)

PIL: draw transparent text on top of an image

fashionable In a project I have, I am trying to create outlines on some text. The general idea is to make the black text slightly transparent to the original white text. For some reason I get black text but it's transparent. Here is the MCVE: image = Image.ope

How to merge a transparent png image with another image using PIL

Arackna: I have a transparent png image "foo.png" and use im = Image.open("foo2.png"); Now I need to merge foo.png with foo2.png. (foo.png contains some text, I want to print that text on foo2.png) Nosklo : import Image background = Image.open("test1.png") f

How to draw lines on an image using matplotlib?

KhoaLearnToCode I'm having a problem here when trying to draw multiple lines on an image. So, here is my code: fig=plt.figure() final = cv2.imread('frame9.jpg') for p in polar: plt.plot([0,1],[p[0],p[0]],c='red') plt.imshow(final,cmap=plt.cm.gray) plt.show

How to draw transparent image in java using BufferedImage?

kusht shah I am willing to display transparent image on canvas in java with the help of graphics2D and BufferedImage. Here is the code to load the image. private static BufferedImage sprites,board; public static void load(){ try { board

How to draw transparent lines on an image using PIL?

Retric Here is what I get: draw.line([(x1,y1),(x2,y2)],fill = (255, 255, 255)) The result is a white line, but I want a transparent line, what should I do? Kay Patel As far as I know, the line function takes RGB or RGBA values. try: draw.line([(x1,y1),(x2,y2)

How to draw transparent lines on an image using PIL?

Retric Here is what I get: draw.line([(x1,y1),(x2,y2)],fill = (255, 255, 255)) The result is a white line, but I want a transparent line, what should I do? Kay Patel As far as I know, the line function takes RGB or RGBA values. try: draw.line([(x1,y1),(x2,y2)

PIL: draw transparent text on top of an image

fashionable In a project I have, I am trying to create outlines on some text. The general idea is to make the black text slightly transparent to the original white text. For some reason I get black text but it's transparent. Here is the MCVE: image = Image.ope

How to draw transparent shapes on an image

Kamiso Plateau How can I draw a shape on an image to cover the content in it and make it transparent? Like the transparent hole in the middle of the image below. edit: I usually use Graphics.FromImage(image)when plotting , i.e. Graphics.FromImage(image).DrawRe

How to draw transparent lines on an image using PIL?

Retric Here is what I get: draw.line([(x1,y1),(x2,y2)],fill = (255, 255, 255)) The result is a white line, but I want a transparent line, what should I do? Kay Patel As far as I know, the line function takes RGB or RGBA values. try: draw.line([(x1,y1),(x2,y2)

How to draw transparent shapes on an image

Kamiso Plateau How can I draw a shape on an image to cover the content in it and make it transparent? Like the transparent hole in the middle of the image below. edit: I usually use Graphics.FromImage(image)when plotting , i.e. Graphics.FromImage(image).DrawRe

How to draw lines on an image using matplotlib?

KhoaLearnToCode I'm having a problem here when trying to draw multiple lines on an image. So, here is my code: fig=plt.figure() final = cv2.imread('frame9.jpg') for p in polar: plt.plot([0,1],[p[0],p[0]],c='red') plt.imshow(final,cmap=plt.cm.gray) plt.show

How to merge a transparent png image with another image using PIL

Arackna: I have a transparent png image "foo.png" and use im = Image.open("foo2.png"); Now I need to merge foo.png with foo2.png. (foo.png contains some text, I want to print that text on foo2.png) Nosklo : import Image background = Image.open("test1.png") f

How to draw transparent shapes on an image

Kamiso Plateau How can I draw a shape on an image to cover the content in it and make it transparent? Like the transparent hole in the middle of the image below. edit: I usually use Graphics.FromImage(image)when plotting , i.e. Graphics.FromImage(image).DrawRe

How to draw transparent shapes on an image

Kamiso Plateau How can I draw a shape on an image to cover the content in it and make it transparent? Like the transparent hole in the middle of the image below. edit: I usually use Graphics.FromImage(image)when plotting , i.e. Graphics.FromImage(image).DrawRe

How to draw lines on an image using matplotlib?

KhoaLearnToCode I'm having a problem here when trying to draw multiple lines on an image. So, here is my code: fig=plt.figure() final = cv2.imread('frame9.jpg') for p in polar: plt.plot([0,1],[p[0],p[0]],c='red') plt.imshow(final,cmap=plt.cm.gray) plt.show

How to draw transparent lines on an image using PIL?

Retric Here is what I get: draw.line([(x1,y1),(x2,y2)],fill = (255, 255, 255)) The result is a white line, but I want a transparent line, what should I do? Kay Patel As far as I know, the line function takes RGB or RGBA values. try: draw.line([(x1,y1),(x2,y2)

PIL: draw transparent text on top of an image

fashionable In a project I have, I am trying to create outlines on some text. The general idea is to make the black text slightly transparent to the original white text. For some reason I get black text but it's transparent. Here is the MCVE: image = Image.ope

How to draw lines on an image using matplotlib?

KhoaLearnToCode I'm having a problem here when trying to draw multiple lines on an image. So, here is my code: fig=plt.figure() final = cv2.imread('frame9.jpg') for p in polar: plt.plot([0,1],[p[0],p[0]],c='red') plt.imshow(final,cmap=plt.cm.gray) plt.show

How to draw lines on an image using matplotlib?

KhoaLearnToCode I'm having a problem here when trying to draw multiple lines on an image. So, here is my code: fig=plt.figure() final = cv2.imread('frame9.jpg') for p in polar: plt.plot([0,1],[p[0],p[0]],c='red') plt.imshow(final,cmap=plt.cm.gray) plt.show

How to draw lines on an image using matplotlib?

KhoaLearnToCode I'm having a problem here when trying to draw multiple lines on an image. So, here is my code: fig=plt.figure() final = cv2.imread('frame9.jpg') for p in polar: plt.plot([0,1],[p[0],p[0]],c='red') plt.imshow(final,cmap=plt.cm.gray) plt.show