Rescuing thousands of images from a blemished life

The OP at dpreview link given by @pphoto suggests the free polaroid dust and scratch removal tool does a similar job to photoshop’s dust and scratches filter. I don’t have the polaroid tool, but can give an example of what it might look like using the dust and scratches tool in photoshop (hope this isn’t against forum policy, I know ps is not FOSS, but the polaroid tool is). This was a pretty fast and crude job, to give an example:

1 Like

@Jeff Please post your examples without the circles. That way we can try removing the artifacts. Edit Preferably as high quality as possible. E.g., you photo in post #6 is super compressed, so much so that I can see tiny square compression artifacts when I zoom in. Those really interfere with image enhancement. However, it may be what you have on hand, then that is all you can provide.

Hi @afre,

Thanks heaps for helping.

Unfortunately, that’s close to the highest quality - when i resaved with the circles and privacy for peoples faces, quality will have only reduced a small amount i suspect. I’ve chosen three images that have those blemishes and have uploaded them untampered.


I really appreciate your help. Very much. I’d love to see if this works with G’MIC - I don’t have easy access to a windows computer (all Linux here) so i imagine getting the polaroid stuff to work with Wine might be problematic. Anyhow, let’s see how it goes. :slight_smile:

Cheers,
Jeff

Maybe it would be a good idea to live with the images as they are for some time. AI in image processing is making great progress. The task could be relatively well done today manually but getting good results by automatization is still challenging. Maybe in 5 years the rescuing “can be done in passing”.

As it looks to me the dust is always at the same place wouldn’t it be possible to overly all images and then generate a mast out of it. If you have the mask you could use gmics inpainting to fix it.

Yes, @Tobias’s suggestion is most sensible. If you can mask reoccurring blemishes, it can go a long way to remove them. Workflow:

1 Mask or select blemishes.
2 Use heal brush, clone brush or in-paint all images. Try selecting all masked areas and then filling them in with large radius brushes or in-painting.


PS No matter how I automate the masking, it always covers areas that are perfectly fine.


PPS @Jeff I made 2 filters for you to try.

G’MIC plugin name (CLI name)
– Clean Photo 0 (afre_cleanphoto0)
– Clean Photo 1 (afre_cleanphoto1)

They are untested and incomplete but I decided to commit them anyway. Their performance depends on the image. Sometimes one works better than the other and vice versa. Remarks:
– “Recovery” → lower value means more changes; higher value means less.
– “Clean Photo 1” → preview can fail on very low recovery values. All you can do is output to new layer to compare and undo if you don’t like the result (at least that works in GIMP).

Hi again,

As always, thanks for the help.

As you’ll probably see if you flick the images in a sequence, those dust marks move, due to minor readjustments that the scanner software has made when it saves the image.

I do think that Thomas’s thoughts might be where I’m leaning, however I’m not sure that this particular issue will be fixed with AI in image processing. I can vacillate though on this. :slight_smile:

I was toying with the idea of working out whether some routine could be written to analyse images to find “runs” of white-ish pixels that are, say, never get narrower than “n” pixels, never get wider than “w” pixels and that are between “x” and “y” pixels in length. Or is that waaaaaaaaay too processor intensive or too hard to figure out?

Cheers,
Jeff

Wow @afre, just seen your PPS.

I’ll give them a try tonight! :slight_smile:

So brilliant - thanks.

Hi @afre,

I updated the filters, but didn’t see your plugins sadly.

Where did you commit them / how do I get access to them?

Thanks again. (Please feel free to just shoot me a link if i’ve missed something obvious.)

Cheers,
Jeff

Ok, i updated on the command line and have them.

So, I’m trying commandlines out now. Thanks, I’ll have a bit more of a play. :slight_smile:

Cheers,
Jeff

Sometimes the plugin doesn’t update properly. Don’t expect too much from the filters though. They aren’t very smart and only meant to give you perspective.

1 Like

Thanks again @afre.

Just quickly, and I’ve been looking for about an hour on this one - what would I append to my gmic command to output a file with the same basename, but a png version. From what I’ve been reading, I feel it has something to do with -output png:{[image],b}, but I’m not sure how to write it…

Cheers,
Jeff

Try outputx.

You are quite right, only one [image] was missing:

o[image] …

but long is

o[image] png:{image,b}.png

If it is the last image in the list

o. {b}.png

(the extension is used for the file format)

1 Like

Ahhh, that’s linked a few coding concepts for me. Thanks. I’m going to have a play now, and write back what I’ve come up with. You guys are very helpful - I think this might work well, but have a few more things to try…

@Jeff Could you please CC license your photos in posts #6 and / or #10, so that we may test and use them as examples?

Hi @afre,

I certainly license you to use whatever I upload to this page for testing purposes and using them as examples.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

I hope the above inclusion helps.

Cheers, Jeff

Here is a light cleaning of image 502 using Clean Photo 0 (afre_cleanphoto0) with an additional user specified list of regions to mask. I haven’t committed this yet because I have to figure out how to make it presentable for the public and perhaps improve the base algorithm.

Original (zoom and toggle between the two)

Light local dust and scratch cleaning (only the more egregious artifacts have been marked)


PS1 Clean Photo 0 / 1 should work in the plugin now. (I placed it in the CLI section by mistake.)

PS2 I forgot to mention that the dust and scratches seem to have R-B aberration. Might be the scanner, photography or something else. What does everyone think about that?

PS3 Made region tiles have slightly smoother edges.

2 Likes

I can’t believe what I’m seeing. That is INCREDIBLY good!!!

I have no idea what R-B aberration means (another thing I have to google) but …

I’m picking myself up off the floor…

I’m going to test this on a few other shots, and try to make a way of automating this in digikam if I can too. I just need to get a good run of time. When I add an inpaint holes thing and auto colour balance too (which I’ll do this as a next stage) I think that’s… just… amazing… You must have cracked the hard part @afre

Wow. “Thanks” is understating things…

please…test everything on a copy of the originals! :smiley: