Gimp-Forum.net
How use a png with a transparent background as a mask - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: How use a png with a transparent background as a mask (/Thread-How-use-a-png-with-a-transparent-background-as-a-mask)



How use a png with a transparent background as a mask - daveq - 02-05-2021

I am trying to add an arrow pointer onto a picture (and plan to do a lot). I have added a png of the arrow, which I know has a transparent background, to a second layer. I have tried to set it up as a mask, but dont understand the finer details - it just stays as a complete rectangle. NB: Have successfully re-sized it & am trying to rotate it. I am new to GIMP, but IT competent.


RE: How use a png with a transparent background as a mask - Krikor - 02-05-2021

(02-05-2021, 06:31 PM)daveq Wrote: I am trying to add an arrow pointer onto a picture (and plan to do a lot). I have added a png of the arrow, which I know has a transparent background, to a second layer. I have tried to set it up as a mask, but dont understand the finer details - it just stays as a complete rectangle. NB: Have successfully re-sized it & am trying to rotate it. I am new to GIMP, but IT competent.

I didn't quite understand, if you have an arrow with a transparent background you wouldn't need to create masks.

But anyway to create a mask it would be something like:

1- With the arrow layer selected, click Layer - Transparency - Alpha to Selection
2- Right-click on this layer and in the pop-up that appears choose Add layer mask - then select Selection

On the other hand, I suggest reading the posts at https://www.gimp-forum.net/Thread-Arrow-Script?pid=17481#pid17481 with suggested scripts for creating arrows.


RE: How use a png with a transparent background as a mask - daveq - 02-05-2021

(02-05-2021, 06:54 PM)Krikor Wrote:
(02-05-2021, 06:31 PM)daveq Wrote: I am trying to add an arrow pointer onto a picture (and plan to do a lot). I have added a png of the arrow, which I know has a transparent background, to a second layer. I have tried to set it up as a mask, but dont understand the finer details - it just stays as a complete rectangle. NB: Have successfully re-sized it & am trying to rotate it. I am new to GIMP, but IT competent.

I didn't quite understand, if you have an arrow with a transparent background you wouldn't need to create masks.

But anyway to create a mask it would be something like:

1- With the arrow layer selected, click Layer - Transparency - Alpha to Selection
2- Right-click on this layer and in the pop-up that appears choose Add layer mask - then select Selection

On the other hand, I suggest reading the posts at https://www.gimp-forum.net/Thread-Arrow-Script?pid=17481#pid17481 with suggested scripts for creating arrows.
Using scripts, which I havent ever done, seems like a complex way to resolve the issue. I presumed with a transparent png  it would be a simple mask task. I have used the attached png in a video editor using chroma key and a colour-picker off the image, which to me confirms it does have a transparent background (but I may be wrong!). Could you try my arrow and see if you can make it work?


RE: How use a png with a transparent background as a mask - Krikor - 02-05-2021

(02-05-2021, 09:32 PM)daveq Wrote: Using scripts, which I havent ever done, seems like a complex way to resolve the issue. I presumed with a transparent png  it would be a simple mask task. I have used the attached png in a video editor using chroma key and a colour-picker off the image, which to me confirms it does have a transparent background (but I may be wrong!). Could you try my arrow and see if you can make it work?
Yes, I could, but where are your arrow?


RE: How use a png with a transparent background as a mask - daveq - 02-06-2021

(02-05-2021, 09:32 PM)daveq Wrote: Using scripts, which I havent ever done, seems like a complex way to resolve the issue. I presumed with a transparent png  it would be a simple mask task. I have used the attached png in a video editor using chroma key and a colour-picker off the image, which to me confirms it does have a transparent background (but I may be wrong!). Could you try my arrow and see if you can make it work?
Yes, I could, but where are your arrow?

Attached now [attachment=5571] ,  I think


RE: How use a png with a transparent background as a mask - Krikor - 02-06-2021

(02-06-2021, 12:15 AM)daveq Wrote:
(02-05-2021, 09:32 PM)daveq Wrote: Using scripts, which I havent ever done, seems like a complex way to resolve the issue. I presumed with a transparent png  it would be a simple mask task. I have used the attached png in a video editor using chroma key and a colour-picker off the image, which to me confirms it does have a transparent background (but I may be wrong!). Could you try my arrow and see if you can make it work?
Yes, I could, but where are your arrow?

Attached now,  I think

Not yet...  Dodgy


RE: How use a png with a transparent background as a mask - rich2005 - 02-06-2021

Quote:I am trying to add an arrow pointer onto a picture (and plan to do a lot). I have added a png of the arrow, which I know has a transparent background, to a second layer. I have tried to set it up as a mask, but dont understand the finer details - it just stays as a complete rectangle. NB: Have successfully re-sized it & am trying to rotate it. I am new to GIMP, but IT competent.

Various ways. 
You can add as a layer, and scale / move / rotate the layer. Another arrow requires another layer.

Use a script / plugin to create the arrow. That is probably the most flexible way and generally produces the best results.

Use your png arrow and create a brush. 
Make it black on a white background, set Image -> Mode to Greyscale and export as a somename.gbr to your brushes folder. C:\Users\"yourname"\AppData\Roaming\GIMP\2.10\brushes
Edit: For a greyscale brush the white base is transparent and black takes the FG colour @ 100% opacity. Various grey values result in reduced opacity.


[attachment=5573]

Refresh the brushes (or restart Gimp) and use the new brush as a 'stamp'.  Uses the current FG colour. Some scope for resizing , rotating using the brush tool sliders, but note this can degrade the stamp due to interpolation.

[attachment=5574]


RE: How use a png with a transparent background as a mask - daveq - 02-06-2021

I understand GIMP much better now. Discovered my arrow that I downloaded off the web is not transparent at all. So have created one. Now adding that as a layer works as expected.

I only need to do a few at the moment. If/when the volume ramps up I will try out your excellent sounding method