Reduce tolerance on edges selection (mosaic)

Talk about Pixelmator Pro, share tips & tricks, tutorials, and other resources.
User avatar

2020-05-11 10:52:10

I made a selection of a black & white image and converted the selection into 48 x 48 pixels in order to make a mosaic of that selection. My problem is that the pixels at the edge of my selection seem to be half transparent. In my example I coloured the background in red to show my problem. A pixel should either have a black and white colour or either not be in the selection. Does anyone know how I can resolve this?

Thanks!

So in this part the pixels on the bordr should be either fully in the black and white or fully red.
Image

Here I would like to have a black line, not half black half red.
Image
User avatar

2020-05-11 12:32:02

Hi Pieter-Jan.

I’ll help if I can. What’s the aim here? Are you looking to create an image with no transparency? Or one where the opacity transitions from 100% to 0% with no values in between?

- Stef.
User avatar

2020-05-11 15:19:59

Hi St3f,

Thanks for helping! Indeed I am looking more for transitions from 100% to %, with nothing in between. The global aim is to obtain a 48 x 48 pixels image, with 6 different tones of grey (including black and white). If possible, it would be nice to know how many pixels I have of each color. I will then use this image to recreate it in LEGO, by using those 6 different colour parts. (The red pixels in my screenshots will not be given any LEGO bricks).

Thanks!

PS: I know there is some free software for making LEGO mosaic patterns, but they don't allow to do modifications like Pixelmator Pro does.
User avatar

2020-05-11 19:12:52

EDIT: This is the effect I am going for: (right now I'm manually colouring every pixel to the closest colour)

Image

Image
User avatar

2020-05-11 19:49:01

Hi Pieter-Jan.

As is often the case in Pixelmator Pro, there are a few different ways of achieving an effect. The method I'd choose to do this with a large image is different (and am bit more complex) than what I would do for a small image.

Here's what I would do for something small, such as what you are working on.

0. Start with your cut-out object with slightly transparent edges.
1. Duplicate the layer.
2. In the layers panel, right click on the top one of the pair and select 'Create Clipping Mask' (Format > Mask > Create Clipping Mask if you prefer menus).
This will put the two into a clipping mask pair. The bottom layer will provide opacity and a base colour and the top will overlay colour information. This differs from a layer mask in that the bottom layer provides a base colour as well as opacity. You won't notice any difference yet because the bottom layer has the same semi-transparent edges that the top does.
3. Choose a base-colour (say black) and with the Pixel Brush at 1px size, paint the edges in on the bottom layer.
4. Remove pixels by using the Eraser mode of the Pixel Brush.

The top layer will still have semi-transparent edges, but they will have their transparency dictated by the harsh edges of the bottom layer.

Hope this helps. If you're struggling or if anything here isn't clear, just post back and I'll do what I can to help. Alternatively, if you want to go down a computational route (no painting), let me know and I'll post that too but, be warned, for a small image it may be more complex that just painting the edges. :)

All the best and I hope this helps.

- Stef.
User avatar

2020-05-11 20:26:17

While I'm here, here's the computational method, which isn't quite as complex as I thought it would be. The trouble is that Pixelmator Pro goes out of its way to smooth edges and you really don't want it to do that.

0. Start with your cut-out object with slightly transparent edges.
1. Create two new blank layers underneath it.
2 Fill the bottom one black (Shortcut: select the layer then hit D for default colours and Cmd-delete to fill the layer with the foreground colour (which is now black).)
3. Use your favourite selection tools to select your fuzzy shape.
4. With the selection still active and the middle layer selected, fill the selection white (Shortcut: Hit D (or don't bother if you haven't changed the colours) followed by Opt-delete to fill with the background colour (which is now white)).
You should have a top layer with your image, a middle layer with a white shape the same shape as your image and a bottom layer that is solid black.
5. Hit Cmd-D to get rid of the selection.
6. Merge the two lower layers (select them both in the layers panel, right-click and select Merge).
You now have two layers.
7. Turn them into a clipping mask pair (right click on the top one in the layers panel select Create Clipping mask)
8. With the bottom layer selected, add the effect Effect > Colour Adjustment > Threshold.
9. With the bottom layer selected, add the effect Effect > Other > Mask to Alpha.
You now have a bottom layer that has a hard edge which can be adjusted using the Threshold slider. The bottom layer is white, though. If you want black, just add an Invert effect above the other two (Effect > Colour Adjustments > Invert). If you want another colour, add a Colour effect (Effect > Fill > Color).

If you want to fine tune the bottom layer with the pixel brush, flatten the effects first. With the Add Effects tool selected, hold down the option key and the Reset Effects button will turn into the Flatten Effects button. Click it.

As before, if you get stuck, just drop a note and I will try to clarify, help (or correct any mistakes I have made in the text :) )
User avatar

2020-05-11 20:28:20

...and one more thing. This but is incredibly clunky but works quite well. If you *really* want to take the colour information from the top layer, release it from the clipping mask, duplicate it about 10 or so times, merge or group the copies back into one layer and recreate the clipping mask group. It will be much more opaque and will provide more colour info.

Hope this helps and have fun.

- Stef.
User avatar

2020-05-12 09:39:07

Quick question — which selection tool are you using to make your selections? If it's the Color Selection tool, you can deselect Smooth Edges to make selections with none of those transitional, partially transparent pixels. The other tools don't currently have this option, so this might be a bit of a long shot.
User avatar

2020-05-12 10:09:54

I knew there had to be something easier than what I was suggesting. :smile:
User avatar

2020-05-12 12:39:01

Well, it's just one selection tool of many, so it may not help, but it would certainly make life easier if it did. :smile:
User avatar

2020-05-31 16:39:57

Hi Stef and Andrius, thank you both for your extensive anwers, they helped me a lot! :smile:
User avatar

2020-06-01 12:18:37

Awesome, that's great to hear!