How to fix a bad scan / scan with lines

Discussion in 'Revell-Fan's Gimp Magic' started by Revell-Fan, Dec 31, 2016.

  1. Revell-Fan

    Revell-Fan Co-Administrator Administrator Moderator

    Joined:
    Aug 1, 2009
    Messages:
    6,066
    Likes Received:
    3,701
    Hello folks,

    first of all please let me apologize for my lack of activity in this section. My plan was to start a "First steps in Gimp" thread but life interfered. This thread is not forgotten, it just needs a bit more time. Sorry for that.

    Well then, lately my trusted HP Officejet 6700 scanner/copier combination has become a bit unstable. Whenever I scan a document the result has bright vertical lines on it. I suppose this is due to dust that has accumulated between the scanner lights and the scanner glass. Unfortunately the HP device is designed in such a way that the glass cannot be removed without tearing it apart, so I am unable to clean it from the inside. I haven't contacted HP's customer service yet because I assume that a repair will cost more than a new printer - IF a repair is possible at all.

    The good thing is that bright documents are not affected. I can scan text and bright images without problems. The lines show up only on dark elements.

    Yesterday I was thinking about getting rid of them using a filter similar to the auto-correction of a digital camera whose image sensor is not working properly. Some cameras have the ability to correct defective pixels by auto-detecting the faulty areas and rendering the flaws invisible. This is done by deactivating the defective pixels and interpolating them using the light and colour values from the surrounding areas. The first step to do so is to photograph a completely white or black canvas. So the errors become visible and can be filtered. I was thinking of applying the exact same trick to my scans.

    To fix the scan it is important that only the brighter areas are toned down and the other areas are left unaffected. The HP tends to scan a document a tad brighter than it is supposed to be in order to capture all details which normally hide in the dark. Black appears not black but dark grey. This doesn't bother me much because I often have difficulty getting my images printed with the correct brightness so I keep them a bit brighter as they should be. And if I don't like the result I can always correct the exposure. It is easier to darken an image than to lighten it up; once an image is too dark it will loose detail which cannot be retrieved. (The same goes for too bright images.) I learned that from "Terminator 2: Judgment Day": The whole movie was shot a tad overexposed in order to preserve dark detail because of the high amount of night shoots. The images were darkened later during post-production.

    Enough talk - now it's time to swing into action! :)

    I chose a fairly dark image to give you an idea how the bright lines affect the scan:

    Scan0052a.jpg

    Then I needed an image with all the bright lines only. I therefore scanned a completely black canvas at the same resolution and of the same size which looked like this:

    Scan0051aa.jpg

    Usually a scan is affectd by dust which is on the original and the scanner glass. That cannot be avoided no matter how careful you are and how dustfree the scanning environment is. A little dust is always there. Since this dust would affect the filter result I had to remove it first. To do so I loaded the image in Gimp.

    1.png

    I zoomed into the image at 200 % to locate all inconsistencies (marked in red). Using the clone tool I removed all major spots. Use a fuzzy brush to avoid sharp edges. It is best to have the clone tool directed (I hope this is the correct English term, just refer to the following image):

    3.png

    Choose an area right below the defective spot, hold down the Shift key, move up the cursor (straight up!) and click. Since the clone direction is set you may continue by just clicking on any other spots to remove them. You have to choose a clone point straight below the cursor because you want the bright lines stay vertical. Once you choose a reference point beside it the line will not stay straight when you clone over it.

    Once the image is cleaned up go to Layers > Colours > invert:

    4.png

    and save as *.png image (to avoid compression artifacts).

    Scan0051ia.jpg

    You can see that the filter sheet is not white but grey. This is due to the scanner scanning brighter and will help us in two ways now.

    Load the scan into Gimp and drag and drop the bright filter sheet into the frame so that it ends up on top of the scan:

    5.png

    Switch the layer mode of the top layer to "exposure":

    6.png

    Et voilá:

    Scan0051aaa.jpg

    No bright lines any longer AND the image exposure was corrected as well! Save the image and you are done. :)
    Last edited: Jan 1, 2017
    Famous Dave and zathros like this.
  2. zathros

    zathros -----SENIOR---- Administrator Moderator

    Joined:
    Apr 6, 2013
    Messages:
    7,697
    Likes Received:
    3,532
    This is very interesting. I have never had this problem with my scanner (and I have two cats and a dog!). That being said, your method for fixing it is excellent. I wonder if the scanner has somehow accumulated dust on the interior? Also, a gentle misting of the area around the scanner, way up in the air will ionize the air with negative electrons and cause the dust to drop. I have taken hard drives apart, doing the whole area before taking the hard drive out of the protective conductive bag (these bags cannot develop an static charge of electricity like normal plastic, which is why it is good to keep them and store electronics in them). Once you have misted the area, and this has to be a very fine mister, you take a cloth and wipre down your scanner before you open it. Take monitor screen cleaner to clean the scanner glass, this will positively charge the surface, and keep dust off of it. Ironically the positive charge p[uts the dust in the air, the negative charge makes them drop, giving you a dust free environment for a small window of time.

    This technique can be seen more dramatically if you are sanding sheet rock, then spray the room with a mister, the air will clear in seconds, this works with anything that crates particulates in the air. Water is negatively charged, and the electrons bind to the particles, making them easy to sweep up. Great technique Revelle-Fan. ;)
    bigpetr and Revell-Fan like this.
  3. Revell-Fan

    Revell-Fan Co-Administrator Administrator Moderator

    Joined:
    Aug 1, 2009
    Messages:
    6,066
    Likes Received:
    3,701
    It definitely has. I can see it through the pane but the pane itself is clear. That's why I assume the dust is on the scanner or the device is defective. However I cannot open it because there are no screws whatsoever; it seems that once it is open it cannot be closed any more. The lines indicate that the fault lies with the scanner itself and its lights / sensors because the lines always appear in the exact same positions (they follow the movement of the scanner). This is the first time I have this problem with a scanner. My previous model (HP PSC 1610) could be completely taken apart and re-assembled, I could even unscrew the glass and clean it from the inside. This one is different, very cleverly designed by the manufacturer - with selling in mind more than fixing. Well, for the time being I am very pleased with the fix. And that you like the solution. :)
  4. zathros

    zathros -----SENIOR---- Administrator Moderator

    Joined:
    Apr 6, 2013
    Messages:
    7,697
    Likes Received:
    3,532
    I think it sucks when manufacturers do this. If they are going to make it not serviceable, them they should make sure nothing, not dust or anything else, including chemical contamination can get in. It has become the norm to make things not repairable. I just lost my 2K screen 8" Tablet, it had 2 Gigs of ram, and 64 Gigs of memory, lost to a small crack on the corner of the screen. I didn't care about it but it caused the backside of the tablet to become capacitive, which meant just touching the thing made it go bonkers. I could not replace the touch screen because it was glued to the LCD screen and the assembly was not available. I don't even know how it got cracked as it never left my home and I used it for playing "Real Racing 3". $240 bucks down the drain, not even a year old.
    Revell-Fan and spaceagent-9 like this.
  5. spaceagent-9

    spaceagent-9 Right Hand Man and Confidant Moderator

    Joined:
    Jul 11, 2013
    Messages:
    1,862
    Likes Received:
    1,206
    if you reversed that process, and made it a multi-layered affair, breaking up parts of the image into depth perspective image layers, and then stacked them into a forced perspective, like ray harryhousen does to lay in models into live action backgrounds and foregrounds, sandwiching, you would have some kind of 3-d tv overlay procedure.
  6. spaceagent-9

    spaceagent-9 Right Hand Man and Confidant Moderator

    Joined:
    Jul 11, 2013
    Messages:
    1,862
    Likes Received:
    1,206
    I forgot to mention, thanks for the tip! an ingenious way to fix that stuff. you got me thinking, and that is dangerous ! lol!
    Revell-Fan likes this.
  7. Revell-Fan

    Revell-Fan Co-Administrator Administrator Moderator

    Joined:
    Aug 1, 2009
    Messages:
    6,066
    Likes Received:
    3,701
    That's what I usually do with my composits (the 3D images of the Triangle ship and the combination of the Revell-Monogram Cylon Raider(s) attacking the paper Tube Ship). ;)
    spaceagent-9 likes this.
  8. Gandolf50

    Gandolf50 Researcher of obscure between war vehicles... Moderator

    Joined:
    Jan 28, 2013
    Messages:
    454
    Likes Received:
    458
    HP uses hidden snap catches..I had them on my old 11x17 flatbed..and they are a pain! Feels like you are going to shatter the case when you crack them open...what you are experiencing..is dust particles on the mirror arrangement or the glass around the light.. as you see they are consistent from top to bottom..and will not go away... your way works ... but I had a slide attachment also and those lines are really bad when scanning at 250% or so!
  9. zathros

    zathros -----SENIOR---- Administrator Moderator

    Joined:
    Apr 6, 2013
    Messages:
    7,697
    Likes Received:
    3,532
    Something in there is positively charging those dust particles. It would have to be taken apart and thoroughly cleaned. You know, if you break one of those tabs, that section could be taped will Gorilla tape to hold it together. :)