: Scan of paper: keep grain pattern, remove gradient I have a hi-res scan of some paper, where you can see the grain. However, the scanner has made some parts of the page darker than others—for
I have a hi-res scan of some paper, where you can see the grain. However, the scanner has made some parts of the page darker than others—for example, it is a lot darker near the page edges. This can be seen when repeating a section of the image (shown below)
How can I even out the colour differences in the page, but retain the existing grain?
My current attempt was to get the average of the page, and then blend this colour via colour burn to the page texture. Gaussian blurring this would give a map of the lighter and darker areas in the page. Inverting that and applying with soft blend to the original page would get close to removing the irregularities.
However, the method described is definitely not the correct way to get an overall map of the light and dark areas, and did not perform as well as hoped. It must be as exact as possible, as I want to be able to move parts of the page around without having a sudden break in the gradients on the page (again, shown in the image).
Any help here would be hugely appreciated!
Edit: I'm not looking to regenerate a paper grain, no matter how close it is, a generated paper grain won't have the right look-and-feel. I need to use the existing grain of the paper.
SOLUTION
To get the paper grain,
Duplicate the original layer
Select -> Color Range, click on some black in the page and drag the slider up until you can see you're selecting all the ink
Select -> Modify -> Expand selection by a few pixels or so
Edit -> Fill and use content aware
To find the shadows,
Duplicate the paper grain layer
Filters -> Blur -> Average
Image -> Apply Image, select the paper grain layer, and use the subtract operation using an offset of 128 and a scale of 1
This will now give you a layer that is mostly mid-grey with darker and lighter areas corresponding to shadows and other blemishes in the picture. Ensure the grey image is both darker and lighter by going into the levels tool and checking that the brightness curve appears on both sides of the midpoint. If it does not, the next stages will not work.
Applying this image in a similar manner as before but to the original scan will change the paper to the average paper colour determined in step 2. However, this will also remove the grain, so to avoid this,
Filters -> Blur -> Gaussian Blur and adjust the settings such that the grain disappears but the shadows are still visible
Finally, to apply this back to the original image and remove the shadows, hide all layers but the original scan, go to Image -> Apply Image, select the shadow layer, and use subtract with an offset of 128 and a scale of 1. Depending on the order of subtractions, this will either remove the shadows, or double them. If it is doubling them, select the invert option in the Apply Image window. Click okay, and it should remove the shadows.
As a last clean-up, you may to reimport the original scan, select just the ink (via select color range), and copy and paste-in-place the ink over the top of the adjusted scan. This is because it is theoretically possible that the edges of the ink will get affected by the transformation described above.
More posts by @Bryan765
4 Comments
Sorted by latest first Latest Oldest Best
I would use a large radius "high pass" filter, followed by a correction with a levels layer.
High pass removes only the low frequency components of an image (the gradient you want to remove), but also centres the average luminosity of an image around mid-gray (by design). By using levels, you can restore the original background colour. The high frequency components (paper grain, music notation) will remain intact. It's a more direct approach of your original attempt.
Takes a bit of fiddling, but this technique works quite well. Generally you want the high pass to be as large as possible while still filtering out your undesired gradients.
This is a perfect situation for the smart-blur tool since the text information is high-contrast with respect to the background.
I have a sample below where I applied a mild smart blur just enough to flatten out the grainy nature of the scan.
I then added a layer filled with RGB(128,128,128) and used the noise filter with color on and gaussian distribution. I then blurred that layer to enlarge the grain a little and desaturated it back to greys. I set that layer to multiply at about 30% opacity. (the sample below shows the layer prior to adjusting layer opacity and blend mode)
Next I placed an exposure adjustment layer overall and brought the exposure up so that it matched the original.
To sum up, smart blur to eliminate the grain and unify the background and then simulate the paper grain.
Others have hinted in comments that the "proper" way to do this is with a fourier transform that isolates the frequencies. You would then smooth certain frequencies and then reverse the transform. I think there may actually be a post buried from a few years ago on this stackexchange that deals with this. I have played with it in the past and it is pretty close to magic IMO.
The manual way to eliminate grain is to blur the low frequencies by somehow doing a high-frequency cut filter and then blur. Then do an overlay of the same image with a low-cut filter and sharpen. You might find tutorials on how to clean up skin blemishes in photos that use this technique.
This is just how I would do this, maybe it's not an option for you. This is a technique that goes very quick and will not affect the quality of your black text at all.
I'd isolate the black text using the levels; the textured
background will become white and the black text will remain 100%
black. To achieve this, you'll need to use the white color picker and click in the "darkest
light gray" portion of your background to turn it to white;probably the gradient you don't like. You'll find the "levels" in the menu "image > adjustments > levels".
Then I'd create my own version of the background by duplicating
some parts of it and merging them together or simply using a texture of paper found online. You can patch up
some areas you don't like with the stamp tool as well or you can decide to hide parts of the text by using the stamp tool or duplicating other areas of your texture. You need to be careful with this, the more you touch your background, the more you might lose the natural effect of your texture! In the example below, I used a nice paper background as it's a very common texture and nicer than using a noise filter. It's also way faster than trying to preserve the original texture you scanned.
Finally, I'd add these 2 layers together in the same Photoshop file;
the text layer would be using a Multiply layer blending effect over
the background layer. This will make the white background of your layer
with the black text "transparent" and the background below with the texture will be visible.
Results: You can make that texture light gray...
Or you can keep it cream...
This way you'll end up with your perfect background, can move the text and page as you want and if you have many different pages, you an re-use the same background for all or simply create 2-3 different versions.
The other benefit is if you need to patch up some imperfections, it won't affect your text at all and you won't need to go around each letter.
And actually, if your project is for offset printing, I'd go even further... I'd save the text part in bitmap mode (lineart) and would use Indesign to merge my background and this new bitmap together by using 2 image frame on top of each others; the bitmap will have a transparent background and will print more clearly as a lineart than as a rasterized image (eg. background + text merged together). This is a common technique used in commercial printing for maximum quality. Maybe the JPG files you have don't have a resolution high enough for this though.
Source and extra info for clean up of scanned images: dw-wp.com/resources/cartooning-quickguides/quickguides-cleanup/
Other option:
using the stamp tool and other selection tools to duplicate the part of the background you like over the parts you don't like (lot of work!)
using a different background similar to the one you like and using
the technique above with the levels and multiply blend mode.
You can't really easily use other patch up tools or curves or adjustments because the texture you don't like seems to have the same kind of color or density as the one you like in your background! It would be hard to select one and not the other without having to do it manually somehow.
Related:
how to compensate 50% opacity white over photograph
clean up the background for scanned document
How to extend the background of an image?
Real non-destructive way of clonestamp tool in Photoshop
In order to keep the texture and even out the background you have to use layer blending. Here is what you need to do:
Create a layer with the desired background color
Place your image on a layer above the background layer
Double click on the image layer and go to Blending options
Press Alt key and move the right slider to the left, until you get the desired texture (see the image). Please note that pressing the Alt key is very important at this step. If you don't press it, you get different result.
Now you can merge all visible layers by pressing Ctrl+Alt+Shift+E (the result is on a new layer)
Enjoy your creation! :)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.