Copy link to clipboard
Copied
So I'm working on this huge scan of a map, about 15.000 x 15.000 pixels. The background is cleared, so most of the file is transparent pixels as in the attached (very small) sample, and inbetween the lines and text of the map.
Problem is, I got countless stray pixels of all colors left (not on the sample image, at least not visible ones). While I can make them visible easily enough with Curves or other means, they are just way too many to delete manually with such a huge file.
I would imagine there is a way to select only objects in an image of a certain size, say, nothing larger than 1x1, 2x2, 3x3, 5x5 pixels, is there? With an option like that, I could just select all of the tiny stuff and delete it with one stroke of a key without affecting the larger structures at all. I've been trying different tools to achieve that but haven't found a way yet. Does something like that exist?
Copy link to clipboard
Copied
I would imagine there is a way to select only objects in an image of a certain size, say, nothing larger than 1x1, 2x2, 3x3, 5x5 pixels, is there?
Have you tried the Filter Dust & Scratches on the Layer Mask?
I would recommend something else first, though.
Layer > Layer Mask > From Transparency (if you actually deleted instead of using a Layer Mask)
Layer > Layer Style > Stroke (Outer) to make the stray pixels more noticable
then use the Burn Tool set to Shadows to brush out the stray pixels at View > 100%
remove the Stroke
Copy link to clipboard
Copied
Can you provide an affected segment of the (layered) image for testing?
Copy link to clipboard
Copied
I tried it on the Layer Mask but didn't get it to work (maybe I just applied it wrong, though). If you apply Dust & Scratches to the map layer itself it does not work due to the stray pixels being surrounded by transparent pixels. When I merge the map layer with a monochrome (i.e., white) background layer, Dust & Scratches actually works pretty well in getting rid of the stray pixels, however it affects the rest of the elements too.
Thanks a lot for your advice, your method is similar to the one I've been using up to now! Visibility is not the main issue however; it's more that there are just so many of the stray pixels that it takes forever to remove them manually.
Link to a sample PSD file, layered (2.2 MB):
https://www.file-upload.net/download-12318677/StrayPixels01.psd.html
Copy link to clipboard
Copied
The download does not seem to work for me.
Copy link to clipboard
Copied
My bad. Does this one work?
Copy link to clipboard
Copied
Sorry, still no luck.
Copy link to clipboard
Copied
I'd suppose your browser's settings block the download from unknown sites. You should be able to recreate the conditions of this case easily by placing a couple of separate objects on a layer, surrounded by transparent pixels, and then putting a couple of single pixels on the same layer.
I'm done with the big map I've been working on for the last couple of days, at least with regards to the stray pixels. But I'd still be interested in learning about alternative methods to get rid of them.
Copy link to clipboard
Copied
Since I don't trust automated techniques as much as my own eyes, I placed the map layer on top of a black solid color fill layer for easy recognition of the tiny pixels. I then used Ctrl/Cmd + clicked the map layer's thumbnail to select its pixels, clicked the "add layer mask" button in the Layers panel, and then painted black on the mask to obliterate the tiny pixels. Example below (and the left-hand sides; left the bottom right corner alone).
If I were to continue, I'd eventually hide or delete the black color fill layer once I was done.
You have to ask yourself if you want to take the time to do this right. It took me in the realm of a minute just to paint out the pixels in those areas.
Copy link to clipboard
Copied
Righty. This is again similar to the technique I've been using: I made an adjustment layer with maximum contrast and minimum brightness, that made all stray pixels visible. Then I just removed them with the eraser tool.
With a map that is hundreds of times this size it is still a very time consuming matter, it took about 8 hours total. As nothing of importance in the file except for stray pixels was of this size, a simple command to delete every lump of pixels below a certain threshold would've saved a lot of time. I'm very surprised Photoshop doesn't contain a function like this; I'd imagine anyone scanning drawings and the like who needs to clean up backgrounds running into this problem from time to time, even if their files are probably not as huge as mine.
Copy link to clipboard
Copied
a simple command to delete every lump of pixels below a certain threshold would've saved a lot of time.
But that’s pretty much what Dust & Scratches does.
If it unduly affects (corners of) regions that are not intended to be affected one can try to address this with masking/selecting.
Copy link to clipboard
Copied
I see! I'm probably just using it wrong (either dust & scratches or the masking). Dust & Scratches works good on the particles themselves (at least when you fill the transparent pixels with a monochrome beforehand), but I've never been able to accurately protect the larger objects with masking. Here's another sample in case you want to try:
But keep in mind that this is just a tiny piece of a huge file.
Copy link to clipboard
Copied
Dust and scratches does a pretty good job when set to radius 1 and threshold 0. If you then follow it by a threshold layer you can sharpen up the wanted pixels.
You are right in that there is a small impact on the edge of the wanted areas - but it will always be a balance.
If you do want to put in a feature request, for the filter you described, you can do so at the link below:
Photoshop Family Customer Community
Dave
Copy link to clipboard
Copied
Thanks a lot, Dave ^_^ These results look very good, so it's just my lack of skill at masking. Got to train that now. I'll probably make the feature request, indeed!
Copy link to clipboard
Copied
No problem .
Just to be clear though - there was no masking involved. Just the Dust and Scratch Filter applied to the section you posted then a threshold adjustment layer added.
Dave
Copy link to clipboard
Copied
Got you It's just a language issue. We use the terminology a bit differently in Germany, the vocabulary is not always 1:1 translatable.
Copy link to clipboard
Copied
Another trick with this sort of image is to use Gaussian blur to smooth out the rough edges, and Smart Sharpen to fix the contrast. You will need to use Levels to remove any feint halos from the sharpen if you use large values
Copy link to clipboard
Copied
I like to use Blend if-settings to be able to use Smart Filtered instances as quasi-Layer Masks.
Not perfect …