Saturday, September 7, 2013

Embarrassing Question: Applying a Transparent Yellow To A JPG or PDF

I actually found someone interested enough in having me research the history of gun regulation in early America to pay me.  (Obviously, not any of the gun rights organizations.)  The deliverables are supposed to be copies of the early laws with the text in question highlighted.  To me, that means putting a light yellow rectangle over the text.  But what application under Windows would you use for that?  Microsoft Paint is only well suited to opaque rectangles (as near as I can tell).  OpenOffice Draw does not seem to be very cooperative either.  Ideally, this would be a solution that I can use to modify both JPGs and PDFs.  Suggestions?

I can draw a rectangle around a section of text, but something that looks more like a yellow highlighter over the text would be preferable.  And what's the solution for PDFs?  Buy the latest version of Adobe Acrobat?

UPDATE: As usual, my very intelligent readers made a number of very useful comments.  I am using the comment about getting OpenOffice Draw to do the job -- and it works great!


  1. I've heard that you can highlight text in PDFs with Adobe Reader, which is free to download. I'm assuming that your PDFs have been run through OCR. Adobe Acrobat (and probably Reader, too) needs to have lines of OCR'd text for the highlighter tool to work.


    If you can find a free OCR program, that would be your best bet. (I can't recommend any because I've never used them.) Even if that same program doesn't allow for highlighting, Adobe Reader (so I've heard) should allow for it--so you can OCR your files with one program and highlight them with the other.

    You should be able to select a bunch of JPG files in Windows Explorer and "print to PDF" (an option available if you right-click and select "print"). That way, you should be able to create PDFs that you can then run through OCR.


    If you find that you're stuck with JPGs and can't turn them into PDFs, or if you don't want to go through the trouble of OCRing them, here's a messy method you can use in MSPaint. The results will depend on how clean the original images are--that is, whether the background is all one color or if it is full of JPG artifacts, creases and shadows on the pages, etc.

    1) Open the file.
    2) Select all (Ctrl-A).
    3) Copy (Ctrl-C).
    4) Draw opaque rectangles over the text to be highlighted.
    5) Make sure that your secondary color is the same as the color of the page--presumably, white.
    6) Paste (Ctrl-V).
    7) While the pasted image is still selected, change the selection to "Transparent selection."

    The rectangles should show up wherever the page is white. They'll look messy immediately around the text, because the grey pixels there will still show up as grey, not darker shades of yellow (or whatever color you used).

  2. Here's a how to on doing this in GIMP

    If you're looking to do PDF, here's a tutorial on doing it using Adobe Reader

  3. GIMP for the JPGs and a PDF reader (e.g., Foxit Reader) with a highlighter function.

  4. This seems like it could be a job for Word, which has a highlighter effect.

    Failing that I'd look at

  5. You can do it in OpenOffice Draw (I'm using version 3.4.0) for JPEGs.

    Draw a rectangle over the text you wish to highlight (using the picture toolbar at the bottom of the screen, select the solid rectangle and draw it). With the cursor on the rectangle, right click it, select "Edit Style", select the "Transparency" tab, then the "Transparency" radio button.

    Also within the "Edit Style" window you can select the "Line" tab to eliminate the solid line that borders the rectangle you've generated, and you can adjust the color to yellow from the "Area" tab.

    This only allows you to highlight a rectangle. If the block of text you want to highlight starts in the middle of one line, continues for one or more lines, and ends in the middle of the last line, then you may have to draw one rectangle for the first partial line, then another for the full lines, then another for the final partial line.

    PDF document:

    If you have Adobe Acrobat, and the document has been OCR'ed or otherwise has the text selectable, do "Tools" > "Commenting" > "Highlight Text Tool">

    If the PDF document has only an image, and the text is not selectable, then the process is similar to that above for a JPEG.

    Draw rectangles as needed with "Tools" > "Drawing Markups" > "Rectangle Tool". Adjust the properties of the rectangle(s) by selecting it/them, right click to "Properties", open the Appearance" tab, and adjust the opacity/fill color of the box and the presence of the border line and the style of the line.

    If you don't have Adobe Acrobat, I don't know how to help you.

  6. Clayton,

    For JPEG's, you need a paint program that can work with "layers." Photoshop could probably do it, as well as the free Paint.NET. But do not ask me how to work with layers! I just know about the concept, but don't have any practical experience.

    For PDF's, Acrobat is the obvious solution. For JPEG's too, in the sense that you can easily import a JPEG into PDF, and then if the text image is clear enough for OCR, you can then highlight it with ease. Acrobat is really worth it for anyone who wants real power over PDF's.

    Can you get an Academic copy of Acrobat?

  7. What a wealth of suggestions! Some of the PDFs were scanned with an HP scanner did not give the OCR option back then. I can pretty easily convert PDFs into JPGs, so I can use that approach.

    I may try using Word first, simply because it makes it easy to write something that explains the context of the law, as well as highlighting the text without changing my copy of the JPG.

  8. Word has a highlighter effect, but only for text, not for JPGs, but it was a good thought.

  9. The solution using OpenOffice Draw turned out to be easy and looks good. Thanks all! The only thing to watch for is that you have select all before doing a File Export to get both the text and the transparent rectangle to appear.