Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Brush Edge Transparency Artefacts
#1
Hello,

newbie Gimp user here trying to learn how to do new things recently. I am making trying to make a custom image pipe actually and I am getting a problem with the semi transparent edges around my images.

Basically when using the image pipe as my brush the semi transparent pixels around the edge of the images are output randomly as anything from the true transparency to black. I fiddled with all setting and could not fix it. I noticed that just simply copying one of the images to clipboard and using that as the brush is creating the same artefacts. It's almost a random drop shadow effect, but I do not want this.

I attached an image showing the issue. I roughly copies in the image pipe images on the right hand side and the left is using it as a brush. I tried transparent and opaque background but the result was the same. You can see the problem most clearly on the 2s with the varying amount of blackness around the edges where there should be nothing but the blue color.


Attached Files Thumbnail(s)
   
Reply
#2
Can you put the brush in a ZIP and attach it?
Reply
#3
I can see the problem, very easy to get odd coloured edge artifacts from the anti-aliased pixels.  
You might have to start again Wink   A bit of experiment and my best effort. I would suggest making a larger brush, better to size down when you paint, rather than up.

1. To keep the antialiasing as uniform as possible, create the brush using both FG and BG as white. I am using a strip for the brush, easier to display but separate layers are OK.

   

2. Set the layer alpha lock on, (the little square top of the layers dock) and paint in each number colour. That should keep the antialiased pixels as uniform as possible.

   

3. Exporting the brush, much the same for a strip or layers.

   

In use gives this.

   
Reply
#4
Wink 
(03-20-2020, 11:52 AM)rich2005 Wrote: I can see the problem, very easy to get odd coloured edge artifacts from the anti-aliased pixels.  
You might have to start again Wink   A bit of experiment and my best effort. I would suggest making a larger brush, better to size down when you paint, rather than up.
Thanks so much for your detailed reply rich2005.  Big Grin

I went through the procedure you mentioned but somehow I am still getting the artefacts. I did make in a larger size as you suggested and I can see the anti aliasing is very smooth and uniform.

I also made a second version of the the brush by not locking the alpha and filling all pixels of the numbers with their colour, such that there is no anti aliasing and they are solid. Strangely I also see artefacts on the edges (somewhat random black edges that vary between strokes of the brush) when using this brush too.

I also upgraded by Gimp from 2.10.12 to 2.10.18 but no change.

I attached my xcf file in which I made the brushes (I couldn't upload the brushes themselves because the forum is blocking the file type).

However, I am seeing this behaviour if I simply make a layer with one number over transparency and copy that to clipboard making it the temporary brush. Just select that brush to paint with it and those artefacts are there. I roughly understand how downsampling/upsampling can effect the granularity of the image but I cannot see why it would be affecting the colour (introducing blackness), and it is happening even when using the brush at normal scale anyway.   Angry

What's got my head spinning now is that this could effect any brush...   Confused


Attached Files
.xcf   numbers.xcf (Size: 57.55 KB / Downloads: 148)
Reply
#5
The paint tool does impose anti-aliasing. You will need to use the pencil tool if using a clipboard brush.  In the screenshot  you can see the anti-aliasing even on 'hard' horizontal and vertical edges. The same applies to transform tools, scaling / rotating for example. edit: Looking at your 1000x200 image I can see that hard edges are still there, particularly the 4. Do not know what you can do .

   

A gih is a brush, so antialiasing will be applied even when the original has none, I thought I had that  minimized when I made the brush. I do not know why you still get that effect. The forum generally accepts small images in various formats anything else, put in a zip file.

I will attach the image and the resulting brush,  only change, re-exported the gih with an incremental setting rather than random.


Attached Files
.zip   numbers2.zip (Size: 15.1 KB / Downloads: 234)
Reply
#6
rich2005, thanks so much again for your help. I have learnt many new things looking into this issue with your advice. Big Grin
Reply
#7
I think this is caused by the brush not being exactly on a pixel, or something like that.

A possible workaround is to make the grid 1x1, by going image->configure grid.

Make sure the grid is not turned on, and then using the option view->snap to grid.

This essentially make the brush snap to pixels. It isn't very useful when you need to use a grid, but I suppose guides can be used as a substitute, or even a grid drawn over as pixels with some transparency.
Reply
#8
Thumbs Up 
(03-21-2020, 10:15 PM)mholder Wrote: I think this is caused by the brush not being exactly on a pixel, or something like that.

Thanks for your input mholder. I tried what you suggested (grid size 1, snap to grid) and unfortunately the same results, but it was worth a go! It does help to visualise the artefacts,

I am trying to make a fantasy cartography map and it's driving me crazy tbh. I have small images I want to brush on like mountains, and they have an outline which helps a lot to differentiate them from each other, but this problem is wreaking havoc on that outline. Some come through correctly and others it gets wiped out or partially there. I can touch it up fairly easily but it's just frustrating that the brush is not consistent as a certain scale.
Reply
#9
I see one explanation. In your file you have the initial white numbers under the colored ones, and this add a slight rim. Dependin on how you do the cut/paste for the brush this ends up in the brush. But you have only the anti-aliased layer it should be fine.
Reply
#10
Tongue 
(03-28-2020, 10:05 AM)Ofnuts Wrote: I see one explanation. In your file you have the initial white numbers under the colored ones, and this add a slight rim. Dependin on how you do the cut/paste for the brush this ends up in the brush. But you have only the anti-aliased layer it should be fine.

Thanks Ofnuts, but I am sure those layers are hidden when copying the image to make the clipboard brush (and removed completely when I generated the custom brush file).

Just having another look into this and I fairly certain now this is just default behaviour of Gimp. When using alpha in the brush, and their is anti aliasing in the alpha channel (ie image created from text tool, or paintbrush tool but not pencil tool), the edge sampling of the alpha channel is inconsistent between brush strokes (at any scale of the brush including its native size).

I know it's being picky but having an edge randomly covered with black pixels can be fairly undesirable depending on how much they clash with surrounding colours of the image. There is probably going to be issues with this sort of thing when downsizing or upsizing the image but if it was at least exactly consistent between strokes it would be more manageable. Even stranger is that on a number like 2, which has hard edges at the bottom there is a lot of these random artefacts on these edge too, even though the alpha and colour channels have hard edges as expected! The fact that it displays this sampling inconsistency even at the native size of the brush makes me think this is a bug.

It would be great if someone could recreate the simple case below to confirm they also see the same behaviour and I am not completely mad or something different with my installation.

1) make 256x256 image with alpha channel
2) use text tool to make one number (2 is good )
3) Ctrl C copy and pick the clipboard brush
4) new image 1000x1000 with transparency, paint on that background with the brush (using either paintbrush or pencil tool) at different scales
5) check the edges..

Its a can help to configure the grid as 1x1 pixel cells and turn it on to really accurately visualise the situation.

I attached my gimp file which has 3 layers, all with a number 2 image made from different methods.

1) text too
2) pencil tool
3) paintbrush tool

Do you think this is buggy behaviour worth reporting? Search function on the gimp bug database is not working for me at the moment.


Attached Files
.xcf   number images.xcf (Size: 19.5 KB / Downloads: 170)
Reply


Forum Jump: