Slashdot stories can be listened to in audio form via an RSS feed, as read by our own robotic overlord.

 



Forgot your password?
typodupeerror
Security

Recovering Blurred Text Using Photoshop and JavaScript 157

Posted by timothy
from the careful-how-you-hide-stuff dept.
An anonymous reader writes "There's been a lot of talk about recovering blurred or pixelated text, but here's an actual implementation using nothing but Photoshop and a little JavaScript. Includes a Hollywood-esque video showing the uncovered letters slowly appearing."
This discussion has been archived. No new comments can be posted.

Recovering Blurred Text Using Photoshop and JavaScript

Comments Filter:
  • Interesting (Score:5, Funny)

    by Captain Splendid (673276) * <capsplendid.gmail@com> on Wednesday October 08, 2008 @05:33PM (#25306639) Homepage Journal

    From TFA:

    The most important feature is the JavaScript scripting environment built into Photoshop, which is far more powerful than the AppleScript environment (and a much nicer language, in my opinion).

    Hey Timothy, are you trying to get the mac fans riled up?

    I'd try this myself, but I stopped pirating PS at version 6. Be interesting to see what other Slashdotters make of this.

  • Oblig (Score:5, Funny)

    by Anonymous Coward on Wednesday October 08, 2008 @05:34PM (#25306651)
    Now for all of the other pixellated stuff...

    Bwahahahaha.
    • Re:Oblig (Score:5, Funny)

      by Anonymous Coward on Wednesday October 08, 2008 @05:54PM (#25306853)

      I'm off to ebay to try it on all those XP serial numbers.

    • I wonder if a technique for faces, for example, could be developed? It could work like the photofit technique used in criminal investigations. A region of a face would be compared to a sequence of pixelated images of typical features until a match is found.
  • by Anonymous Coward

    20x zoom. Mr. Data, what does that look like to you?

    • by gardyloo (512791) on Wednesday October 08, 2008 @05:38PM (#25306689)

      BIG squares.

    • Space Ghost: Wait a minute! Computer, zoom in.
      [Control monitor zooms in on painting of Golden Gate Bridge on Space Ghost's wall, forming two big blocks]
      Automated Voice: Enhancing.
      [Image becomes one big yellow block]
      Automated Voice: Enhancing complete.
      Space Ghost: That's the bridge I painted. It's like they filmed this tape recording in an exact replica of my apartment. Wait a minute! They must be in my apartment! But wait a minute...
      Automated Voice: Yellow.
      Space Ghost: How'm I gonna get in there?
      Automated V

  • Just ovveride? (Score:5, Insightful)

    by Dreen (1349993) <dreen1@@@gmail...com> on Wednesday October 08, 2008 @05:43PM (#25306737)
    I never understood why people use pixel mis-mashing when they want to obfuscate something in an image.

    drawing a big black rectangle is 10x faster and there is no way you can de-obfuscate that
    • Re:Just ovveride? (Score:5, Interesting)

      by fbjon (692006) on Wednesday October 08, 2008 @05:49PM (#25306811) Homepage Journal
      It may stand out too much in the layout. What would be interesting (maybe even useful) is developing a formula that determines the minimum mosaic size for a given font style/complexity and size that makes reversing it produce ambiguous results, one extreme being a black rectangle, the other no mosaic at all.
      • Re:Just ovveride? (Score:5, Interesting)

        by Zadaz (950521) on Wednesday October 08, 2008 @06:03PM (#25306943)

        Why not make a "secure" mosaic filter that does one or more of the following:

        - Randomizes the pixel data before applying the mosaic (Keeping the original colors so the mosaic looks natural.)

        - Applies noise to the area before applying the mosaic (Could use intensity noise rather than hue to retain the color scheme that is being obfuscated.)

        - Requires the user to drag the smudge tool across the area by a pre-determined amount to randomize the data before the mosaic.

        - Apply noise to the mosaic pixels, (1:1 with the mosaic size) after it has been applied.

        These would all retain the look of the mosaic but would defeat the reverse engineering tactics displayed here.

        Heck, forget the plugin, these would be pretty simple to automate these within Photoshop.

        • by larry bagina (561269) on Wednesday October 08, 2008 @06:44PM (#25307323) Journal

          Heck, forget the plugin, these would be pretty simple to automate these within Photoshop.

          This is gimp country. On a quiet night, you can hear adobe squeal like a pig.

        • by Anonymous Coward

          Remove the text you want hidden and replace it with some lipsum of believable length and general consistency. Apply standard mosaic filter. Simple, relatively quick, no special software needed.

          • by RMH101 (636144)
            Woah there! You expect us to listen to you when you come up with a simple solution, applicable on all systems, and with zero cost? This is slashdot! C'mon, we need an enormously over-complicated code solution - preferably with some OS zealotry thrown in to keep it interesting.
        • randomize after (Score:3, Insightful)

          by pikine (771084)
          If you randomize pixel in any way before applying mosaic, adding noise or just randomly permute the pixels around, then what you get in the mosaic is going to be the same colored blocks that look like a solid colored strip. That's because mosaic computes the average of the pixel values that fall under the block, which would be the same for all blocks if randomness is evenly distributed. However, if you apply mosaic first and then randomize the blocks after, then the result looks much more like mosaic and y
        • by Yvan256 (722131)

          No need to be that complicated.

          Just replace the text you want to hide before applying the mosaic.

          Which text? Oh, I dunno. Something like "Ha-ha! You just lost time decrypting this sentence! /Nelson".

        • Why not make a "secure" mosaic filter that does one or more of the following:

          - Randomizes the pixel data before applying the mosaic (Keeping the original colors so the mosaic looks natural.)

          - Applies noise to the area before applying the mosaic (Could use intensity noise rather than hue to retain the color scheme that is being obfuscated.)

          Better yet, replace the text with the blurred values of "lorem ipsum ...", or some other random text. That way, it still will have the white/black balance of text-that's-

      • Re: (Score:1, Insightful)

        by Anonymous Coward

        Better is to blur something completely different from the original. Then if someone decodes it all they will get is a funny message about them wasting their time (or maybe a big "fuck you" or something).

      • by Dreen (1349993)
        Oh please
        I honestly cant think of a situation where I have an image I want to post somewhere, but I need to obfuscate some part of it but Im too damn pedantic to use a solid-colour cover. It doesnt even have to black, nor a rectangle.
        • by fbjon (692006)
          Yes, I didn't say it must necessarily be useful. :)
        • by plover (150551) *

          It doesnt even have to black, nor a rectangle.

          How about a pair of red stars with the words "Girls Gone Wild" written on them?

          • by HTH NE1 (675604)

            How about a pair of red stars with the words "Girls Gone Wild" written on them?

            Make sure what you're obscuring isn't also reflected in the chrome grill of the semi cab behind her. (They actually missed that for months.)

      • by functor0 (89014)

        My personal favourite for taking out such information in Photoshop is to use the Patch tool. Copying over a piece of the background over the letters/numbers erases them in such a way that looks like they never existed before.

    • Re:Just ovveride? (Score:5, Insightful)

      by Jabbrwokk (1015725) <grant DOT j DOT ... AT gmail DOT com> on Wednesday October 08, 2008 @06:04PM (#25306961) Homepage Journal

      Absolutely agree.

      Plus TFA says the original image was blurred using the Photoshop "mosaic" filter. So this approach, while interesting for text blurred using that exact filter, is probably useless in most real-world approaches, such as trying to recover text obliterated with the rubber-stamp tool, or like you suggest, a black box.

      • while i agree that this has few practical applications, it's still a pretty novel method of countering mosaic'd text. the author's not going to make any money off of this idea, but you have to give him credit for ingenuity. the most impressive part is that he slapped this together using a single popular off-the-shelf program and a few lines of JavaScript code.
        • the most impressive part is that he slapped this together using a single popular off-the-shelf program and a few lines of JavaScript code.

          Oh, I totally agree. Imagine what he could do if he had access to the algorithms that drive the mosaic filter.

    • Re:Just ovveride? (Score:5, Informative)

      by Tumbleweed (3706) * on Wednesday October 08, 2008 @06:10PM (#25307017)

      drawing a big black rectangle is 10x faster and there is no way you can de-obfuscate that

      Just make sure you're not saving in a file format that has a preview, where the preview doesn't have the obfuscation updated. :)

    • by GFree678 (1363845)

      A big black rectangle is UGLY. Since blurring things looks a lot nicer, the media tends to prefer it. Image is everything, even in the modification of such. :)

    • by IdahoEv (195056) on Wednesday October 08, 2008 @07:05PM (#25307485) Homepage

      drawing a big black rectangle is 10x faster and there is no way you can de-obfuscate that

      That's not entirely true. There was an article a couple years back about a technique for recovering redacted text with pretty high reliability.

      It used the fact that most standard fonts have variable spacing, and that once you've determined the font you can model that only certain combinations of letters will actually fit in the space of the redacted word or words. Combined with a dictionary and bayesian matching based on nearby words, you can often figure out what words would have fit into a redacted rectangle. Or at least limit it to a fairly small pool of possibilities.

      They demonstrated it on a redacted government document, and pulled out some places where the redacted words had to be "Iran" and "Ahmedinejad" etc., because nothing else both fit and made sense. If it's a monospaced font, you know the exact number of letters of the redacted text.

      I can't find the original link, but here's a paper [lehigh.edu] that describes some of the techniques available for "cracking" blackout redaction. (some apply only to magic-marker-type redaction, but others apply even to electronic black-rectangle redaction).

      • Re: (Score:2, Interesting)

        by Dreen (1349993)
        Thats pretty interesting. The document lists some good countermeasures but still, the more you obfuscate, the harder it becomes to "brute-force" it back. For whole long-ish sentences it would probably be impossible.

        Plus, if you are obfuscating an important, scanned document, and its cruicial you hide stuff in it, the best option is to OCR it, and simply delete the snippets you dont want.
      • by WK2 (1072560)

        Wow! You a smart mother----er. I would have never thought to -- that.

        Seriously, that's kind of obvious. A lot of us have seen redacted government documents, and it's usually pretty obvious what words go where. I've seen one where they left the bottom few pixels of a line, and it was simple to figure out what it said.

        The only way redacting a document has a chance of working is if you are redacting numbers, or entire paragraphs, and there is no way you are going to recover an account number that has been blac

        • by TheLink (130905)
          "is no way you are going to recover an account number that has been blacked out"

          Unless you saved it in layers - where the blacked out part is on top and the stuff underneath it is still there.

          Hilarious when other people do that. Not so funny if it's your people ;).
      • Personally I always thought the scariest thing was the technology that recovered text from the sound of a person typing.
      • by bumby (589283)
        So, you make your rectangle a (random) couple of pixels wider than the text you want to cover - problem solved.
        • by bumby (589283)
          I just realized that I totally forgot about the fact that you normally censor text inside a block of text, so it's of course possible to figure out the width of the censored text by its surroundings. Guessing the best way would be to simply remove the text you want to censor and replace it with [censored] or something...
      • by JSBiff (87824)

        Umm, in the case where a single word is being obfuscated, there is no way around the technique you mentioned. Heck, you can often do what you are talking about without a computer. Just read the text, and you can often guess what a missing word is by context.

        Assume, for a moment, that 2 or 3 lines of text have been 'blacked-out', and it suddenly gets extremely challenging for either human or computer to guess the missing text. Or, let the redacted text be something like a telephone number, password, social s

      • by dkf (304284)

        There was an article a couple years back about a technique for recovering redacted text with pretty high reliability.

        It used the fact that most standard fonts have variable spacing, and that once you've determined the font you can model that only certain combinations of letters will actually fit in the space of the redacted word or words.

        The Big Black Box approach works really well with numbers, as digits are often all the same width even in variable-width fonts. Add to that the fact that most often you could reorder the digits and still have something equally plausible, and you've got no way to recover; the information is gone.

    • drawing a big black rectangle is 10x faster and there is no way you can de-obfuscate that

      ...unless someone saves that as a separate layer. PNG or JPG only!

      • by HTH NE1 (675604)

        ...unless someone saves that as a separate layer. PNG or JPG only!

        I don't know about PNG, but I believe JPG can also contain more image pixels than are actually displayed. I know for certain GIF can. Simply put, the image can be bigger than the viewport in which it is displayed, or even simpler, the image is overscanned. Some image views can expand the viewport revealing the cropped data. (A certain small underscanned GIF can crash some browsers when they fail to allocate memory for it.)

        There's even easier ways on television. First, in standard definition programming, of

  • by Empiric (675968) on Wednesday October 08, 2008 @05:50PM (#25306827)

    Is it not the case that the reason this works is because you're running the -same blur algorithm- with the -same input- (the unblurred letters/pixels) and simply iterating through the letters and looking for equivalent output?

    Presumably, the blur algorithm output could resolve such that multiple unblurred letters resolve to the same blurred pixels, but even if it is not this trivial to map the input state to output state, it still wouldn't seem to me to approach solving the general case of letters "blurred" by any arbitrary means, which is the real-world capability implied by the article.

    What am I missing here?

    • by sexconker (1179573) on Wednesday October 08, 2008 @06:23PM (#25307129)

      You're not missing anything.
      This guy tried to read some blurred text on his friend's site, so he decided to mess around in photoshop.

      He got over zealous and did some javascript stuff in photoshop, based on blurring known text and attempting to reblur and match that text 1 letter at a time.

      He was then disappointed that he couldn't use the thing to unblur assumed text of unknown font, font settings, color, language, character set, and blurring algorithm after unknown layers of image alteration after the text was rendered, and after unknown compression.

      • by nog_lorp (896553) *

        He then tried to make it worth his while by posting to slashdot.

        • Re: (Score:3, Funny)

          by MadKeithV (102058)
          The ????? is finally revealed!
          1. - Get frustrated at blurred text
          2. - Fail to write unblur filter
          3. - Post to slashdot
          4. - PROFIT!!!!
  • Ideal conditions (Score:5, Interesting)

    by Itninja (937614) on Wednesday October 08, 2008 @05:56PM (#25306871) Homepage
    The article mentions the authors 'cheating a little' by de-blurring the image under 'ideal conditions'. From what I can gather, he is using a source Photoshop file (PSD) as the sample. If he already had access to the source PSD file, wouldn't it be easier to just click undo a few dozen times? Can this be reproduced to a raster image at all?
    • Re: (Score:3, Insightful)

      by X0563511 (793323)

      I imagine the "cheating" aspect of using a PSD file is that you are working with a lossless image. There's no JPEG/MPEG compression going on etc. Working with another lossless format like BMP, or PNG, would probably work just as well.

      • Re: (Score:3, Interesting)

        by petermgreen (876956)

        What is more significant is knowing exactly which font and which blur filter was used. Also having the filter applied evenly is going to make things far easier than if someone grabs the blur tool and scribbles over the area with it.

    • Re: (Score:2, Informative)

      by nobodymk2 (1137293)

      Once I hit "save" in photoshop and exit I can't undo. Although in a layered image the rasterized text (must be rasterized before we can liquify/blur it) would probably be on a separate layer, but it's generally much more incriminating to replace text and not unblur text and it's probably not layered like that.

  • Old tech (Score:5, Funny)

    by Glith (7368) on Wednesday October 08, 2008 @06:03PM (#25306947)

    Jeez. Hasn't anyone seen CSI?

  • Failure (Score:5, Insightful)

    by sexconker (1179573) on Wednesday October 08, 2008 @06:13PM (#25307051)

    "While my original goal of recovering the censored text on my friendâ(TM)s page was never achieved, the project was a success."

    I wouldn't call that a success...

    Good execution of a basic concept, but the fact remains that this shit is infeasible in practice. You have all the font issues (the typeface, the spacing, the color, the size, etc.), and you've got all the source issues - Are you sure that's text? Is it English? Was it obfuscated in other ways? Has the image been altered after the text was rendered? How has compression affected it?

    The biggest fucking issue, of course, is that you're assuming the text was obfuscated using photoshop, or at least very similar blurring/pixelating algorithms.

    It's a great project in terms of using javascript and photoshop to do something neat but basic in concept (essentially brute forcing, as the author says).

    But unless you have inside info about how the text was rendered and obfuscated, you're better off taking a step back and squinting.

    I think I see a duck.

    • Re:Failure (Score:4, Funny)

      by finiteSet (834891) on Wednesday October 08, 2008 @06:53PM (#25307389)

      But unless you have inside info about how the text was rendered and obfuscated, you're better off taking a step back and squinting.

      Little Girl: "Wow! It's a schooner!"
      Willam: "You dumb bastard! That's not a schooner, it's a sailboat!"
      Little Boy: "A schooner is a sailboat, stupidhead!"
      Willam: "Well you know what? THERE IS NO EASTER BUNNY! OVER THERE, THAT'S JUST A GUY IN A SUIT!!"

  • So... (Score:1, Flamebait)

    by GFree678 (1363845)

    Where's the comments complaining about how they didn't find a similar way to do this in GIMP?

    Or maybe they did, but it's not here. Not that I can tell from a 500 sever error. :)

    • Re: (Score:3, Funny)

      by sexconker (1179573)

      You can do the exact same thing in GIMP rather easily.

      Get some image with blurred text.
      Try blurring some letters to match up with the blurred text.
      Fail.

      See? You've already done what this guy did with javascript, photoshop, and who know how much wasted time.

  • Coral Link (Score:3, Informative)

    by mrbene (1380531) on Wednesday October 08, 2008 @06:17PM (#25307075)
    I'm getting a 500 status connecting to the original, but it seems that Coral CDN has a decent cache [nyud.net].
  • "The easy way to read numbers"
  • Short version (Score:5, Interesting)

    by rabtech (223758) on Wednesday October 08, 2008 @06:28PM (#25307173) Homepage

    If you know the blur algorithm, you can run each character through it to produce the blurred output, then compare that result to the image you are trying to unscramble and pick the closest match.

    This assumes the blurring doesn't cause pixels to overlap their neighbors too much, that the algorithm produces deterministic output (isn't random), and that there are few possible inputs resulting in the same blurred output.

    If the letters overlap because the blur blends with its neighbors then it just becomes a computational complexity problem where you have to try words instead of letters. A lot harder, but not totally impossible.

    A blurring algorithm that used some large mosaic effect prior to bluring or used randomized input would produce a similar looking blur effect, but without disclosing much about the input.

    Personally, I'd prefer examining the blur area for the predominant background color and create a gradient/mosaic around that color to fill the area. Then there is absolutely no chance of recovering information, but the effect on video wouldn't be too horribly jarring (as a black box might be).

    • Pfft. If you're going to go to that much effort, just blur up some alternate text and stitch that in instead. The pixelation will hide the edge artifacts.

      Then you can taunt them a second time-a

    • by 4D6963 (933028)

      If the letters overlap because the blur blends with its neighbors then it just becomes a computational complexity problem where you have to try words instead of letters.

      Yeah, or you could learn a bit about signal processing and simply just cross-correlate each "blurred" letter with the image to decipher. Why would take only as many cross correlations as there are characters in the alphabet, because it would detect all the occurrences of a letter in the entire image in one pass, if it's good enough to dete

  • by vodevil (856500) on Wednesday October 08, 2008 @07:36PM (#25307725)
    I think people would be more interested if this removed the blur from nipples.
  • I'll bite. What the hell is this a reference to?

    • by Skrapion (955066)

      I have no idea; I clicked on it to see if anything else had the same tag, but that really didn't do what I expected! Now I've apparently "voted" for the tag, and I have no idea if there's any way I can remove my vote.

      Anyway, no other stories have received the same tag, if you're curious.

    • by Ant P. (974313)

      I guess it's a reference to they way normal people turn into complete dickheads when given the chance to do something retarded online with complete anonymity.

  • Mr. Robinson was indicted for violating a recent patent owned by Apple, Inc...

    (take a look at the website)

  • javascript dock? (Score:3, Interesting)

    by Eil (82413) on Wednesday October 08, 2008 @10:07PM (#25308829) Homepage Journal

    Holy cow, I thought I had seen all possible ways to crapify a web page via Javascript, but today I have learned of another: Adding a partially transparent Mac OS dock to it. So that when you scroll down (as you normally do with web pages), the thing jumps around like a monkey on amphetamines. And you presume that it doesn't get any worse than that, wouldn't you? You would, but then you'd be wrong because it also does the magnification thing and it does it about as well as you'd expect Javascript to do it.

    Now if you'll excuse me, I'm heading out to abuse my 2nd Amendment rights.

  • Yulia Nova's boogie, here we come!

I have never seen anything fill up a vacuum so fast and still suck. -- Rob Pike, on X.

Working...