ot photoshop question? trying to clean up the grey

MistaraMistara Posts: 38,675
edited December 1969 in The Commons

this is a scanned packing slip.

is there an easy way to filter out the gray and leave only the text and lines?

Thanks :)

greys.JPG
408 x 351 - 32K

Comments

  • Hiro ProtagonistHiro Protagonist Posts: 699
    edited January 2015

    I would use the magic wand tool to select the grey and then press delete to delete the grey areas. Your background colour must be white before you delete (unless you change the background to a layer). Possibly some of the buttons will not select along with the main background so select these individually. Use a low tolerance—say 16.

    Edit: just realised you are not talking about the Photoshop dialogue! I wondered why you would want to do that. This technique will probably not work well if there are lots of continuous variations in the grey, which there probably are. Beyond using levels and contrast etc., as you are doing I'm assuming, I can't think of an easy way.

    Post edited by Hiro Protagonist on
  • jorge dorlandojorge dorlando Posts: 1,157
    edited December 1969

    Well, I do not have photoshop, no more ...
    But here I used Gimp, in this example
    in your case, as is text, it may be that the values are different from this obtained for my render, but all you have to do is slide the values in Table brightness and contrast

    cinza2.jpg
    1920 x 1527 - 297K
    cinza1.jpg
    1920 x 1527 - 304K
  • Richard HaseltineRichard Haseltine Posts: 102,770
    edited January 2015

    I would apply a level adjustment layer and pull the white point down (and the black point up) until the results looked OK. If there are odd marks left you may be able to use the clone or healing brushes to remove them. It's better, if you can, to do the equivalent of the levels adjustment in the scanner since that handles the raw data - especially if you scan to 8 bit formats.

    Post edited by Richard Haseltine on
  • SpottedKittySpottedKitty Posts: 7,232
    edited December 1969

    The Levels dialog is the way I've always done it, but note that it only works if the scan is good enough — fuzzy thin lines, and stuff-that-should-be-black too close a shade of grey to stuff-that-should-be-white have a tendency to disappear if you're not careful.

    Look at the levels graph in your screenshot. The "bump" on the left side is the nearly-black pixels, the "bump" on the right is the nearly-white pixels. All you need to do is drag the little triangles immediately below the graph until they're close to the plateau in the middle of the graph. You might also need to juggle the centre triangle, which sets the mid-grey point. Remember to tick the Preview box so you can see what you're doing before you commit yourself.

    One word of caution if there's text in the scan — make sure it still reads the same after you've done the adjustment, letter shapes count as "fuzzy thin lines" as I noted above. If the original scan isn't quite good enough, some letters can come out badly distorted. I usually have to go over the scan with a small brush/eraser afterwards, cleaning up any remaining stray scruffy bits.

  • Hiro ProtagonistHiro Protagonist Posts: 699
    edited December 1969

    Another method that may work quite well is to use Custom Filter in Photoshop. This is one of the more mysterious filters in PS which can be found under Filter/Other. By default there is a 5 surrounded by -1 values. Change the 5 to a 6 or higher and see if that gives you the result you want. You can get a similar effect on a document like this with Image/Adjustments/Threshold.

  • MarkIsSleepyMarkIsSleepy Posts: 1,496
    edited January 2015

    Just to give you one more option :) - if your version of Photoshop supports it (not sure when it was added) you can go into the layer styles Blending Options and use the "Blend If" sliders too. I've used this technique many times to very quickly and neatly clean-up scans of line art and sketches.

    Insert a pure white layer underneath the layer your scan is on, double click the layer with the scan to open the layer options and where it says "Blend If Grey" move the right hand slider for "This Layer" to the left until all the grey disappears.

    After.JPG
    1634 x 953 - 119K
    Before.JPG
    1489 x 854 - 108K
    Post edited by MarkIsSleepy on
  • Takeo.KenseiTakeo.Kensei Posts: 1,303
    edited December 1969

    Most efficient technique would be to use posterize or threshold function

  • MarkIsSleepyMarkIsSleepy Posts: 1,496
    edited December 1969

    Most efficient technique would be to use posterize or threshold function

    Takeo.Kensei,

    Neat - I had never played with the threshold adjustment layer before; I'll have to remember that. The problem with being self taught is gaps like this in my knowledge. :)

    I don't understand how posterize would work for this though - I'm playing around with it and at higher settings it doesn't seem to do much and at lower settings it creates "cow" patterns from the grey parts that started out close to black. How would you use it here?

    Thanks,
    Mark

    Posterize.JPG
    1040 x 741 - 62K
  • jorge dorlandojorge dorlando Posts: 1,157
    edited December 1969

    Most efficient technique would be to use posterize or threshold function

    well remembered! I had forgotten this! This works !!! threshold

  • jorge dorlandojorge dorlando Posts: 1,157
    edited December 1969

    Just to remind you, my Gimp is in Portuguese of Brazil,
    Then, Limiar =Threshold

    limiar2.jpg
    1920 x 1527 - 278K
    limiar.jpg
    1920 x 1527 - 291K
  • SpottedKittySpottedKitty Posts: 7,232
    edited December 1969

    I used to use Posterise (after all other tweaks have been done) way back in the Elder Days* — it did help, but IIRC its biggest effect was in allowing a reduced compressed file size without too much extra quality loss. Not really needed nowadays, but I agree, it's a handy technique to keep in mind.

    Speaking of reduced file size, was the original scan in greyscale or full colour mode? Some of these techniques we've been discussing can sometimes introduce a little bit of colour cast unless the image is greyscale.

    * I first learned to use Photoshop way back in version 4. Not CS4. Yes, that long ago...

  • jorge dorlandojorge dorlando Posts: 1,157
    edited January 2015

    Oops! Now I saw that you tried to posterize, and not the threshold

    Post edited by jorge dorlando on
  • macleanmaclean Posts: 2,438
    edited January 2015

    Just to add to the confusion, another option is to use Selective Color - Image> Adjustments> Selective Color.

    Select Color> Whites, Neutrals or Blacks and play with the sliders. This dialog is also useful for targetted Hue adjustments.

    In Photoshop, there are usually umpteen different ways to get a result, and it's instructive to play with them all.

    mac

    Post edited by maclean on
  • Richard HaseltineRichard Haseltine Posts: 102,770
    edited December 1969

    The slight drawback with threshold is that it's either/or - so you lose any anti-aliasing around the edges of curved or angled lines. That isn't always a bad thing, for example with lines at a very shallow angle, but it may make the result look unnecessarily jagged.

  • jorge dorlandojorge dorlando Posts: 1,157
    edited December 1969

    Well, I will also add to the confusion:
    There is a filter in my gimp I did not know existed:
    "Repair Scanned document"

    lim6.jpg
    1920 x 1527 - 263K
    lim5.jpg
    1920 x 1527 - 365K
  • Takeo.KenseiTakeo.Kensei Posts: 1,303
    edited December 1969

    MDO2010 said:
    Most efficient technique would be to use posterize or threshold function

    Takeo.Kensei,

    Neat - I had never played with the threshold adjustment layer before; I'll have to remember that. The problem with being self taught is gaps like this in my knowledge. :)

    I don't understand how posterize would work for this though - I'm playing around with it and at higher settings it doesn't seem to do much and at lower settings it creates "cow" patterns from the grey parts that started out close to black. How would you use it here?

    Thanks,
    Mark

    I may pass a Level filter before. However there is also a tool in Gimp Called Reinhardt that can do the job in that case. Screenshot below

    @Jorge: The filters are in Tool->GEGL Operations in latest Gimp 2.8+

    Gimp_GEGL.png
    798 x 530 - 56K
    Gimp_Reinhardt.PNG
    921 x 823 - 183K
  • jorge dorlandojorge dorlando Posts: 1,157
    edited December 1969

    Hello, thanks for the tip
    I ... I found the filter: "scanned document repair"
    In the menu / filters / G'MIC

    repairdocum.jpg
    956 x 454 - 101K
  • SpottedKittySpottedKitty Posts: 7,232
    edited December 1969

    maclean said:
    In Photoshop, there are usually umpteen different ways to get a result, and it's instructive to play with them all.

    If no-one minds me slightly mangling Kipling:

    "There are nine and sixty ways of constructing postwork lays, And every single one of them is right!"

    ;-)

Sign In or Register to comment.