DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: switch black and white in tiff files  (Read 19,401 times)

eleman

  • Spam Killer
  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 413
switch black and white in tiff files
« on: January 23, 2013, 08:22 AM »
I'm looking for a simple software to switch colors in b&w tiff files. There are hundreds of pages of documents scanned weirdly, with the background in black, and the text in white. I need to print them, but the black background would make me bleed ink.

So if only I can find an utility to make blacks white, and whites black... In batches preferably.

Any ideas?

Renegade

  • Tell me something you don't know...
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
    • Participated in NANY Challenge Three Times
    • Furry Fandom Badge - Furry Fandom
    • Linux User
Re: switch black and white in tiff files
« Reply #1 on: January 23, 2013, 08:27 AM »
Not a solution, but an idea - would you be able to write a script in the GIMP or Photoshop to do it?
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

Renegade

  • Tell me something you don't know...
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
    • Participated in NANY Challenge Three Times
    • Furry Fandom Badge - Furry Fandom
    • Linux User
Re: switch black and white in tiff files
« Reply #2 on: January 23, 2013, 08:30 AM »
Oh - another thing - are the TIFFs multi-page images or single images?
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

eleman

  • Spam Killer
  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 413
Re: switch black and white in tiff files
« Reply #3 on: January 23, 2013, 08:32 AM »
TIFFs are multi-page images.

Actually, I can come up with a gimp script. That's a good idea. I should have thought of it. Thank you very much.

vlastimil

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 308
    • Participated in NANY Challenge Three Times
Re: switch black and white in tiff files
« Reply #4 on: January 23, 2013, 08:35 PM »
My memory is not what it used to be, but there may be a flag in tiff files that indicates what is black and what is white. Could it be that the software you are using for viewing the files ignores it? Maybe the files are OK (and maybe not).

eleman

  • Spam Killer
  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 413
Re: switch black and white in tiff files
« Reply #5 on: January 23, 2013, 09:11 PM »
My memory is not what it used to be, but there may be a flag in tiff files that indicates what is black and what is white. Could it be that the software you are using for viewing the files ignores it? Maybe the files are OK (and maybe not).

It appears that this is the case. Faststone maxview shows the files with white text on black background. Gimp, on the other hand, shows them as one might expect. I was able to print them correctly from gimp.

Renegade

  • Tell me something you don't know...
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
    • Participated in NANY Challenge Three Times
    • Furry Fandom Badge - Furry Fandom
    • Linux User
Re: switch black and white in tiff files
« Reply #6 on: January 24, 2013, 02:47 AM »
Black is white and white is black?  :huh:

Gotta say, it's almost comical. :D
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,027
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Linux User
Re: switch black and white in tiff files
« Reply #7 on: January 24, 2013, 04:17 AM »
Xnview has a batch convert mode, and a function to invert colors.  Set your folders, select the files and apply the "Negative" function.  I used it all the time when I was scanning images of construction plans and came across the old ones that were purple with white lines.  The machine I was using scanned in black and white to tiff, so it was perfect.
It can handle multi-page tiffs as well.
All children left unattended will be given a mocha and a puppy.

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: switch black and white in tiff files
« Reply #8 on: January 24, 2013, 04:24 AM »
It can handle multi-page tiffs as well.

Strange, I thought of XnView yesterday when I read the thread but when I tried a multipage TIFF, (that I created for the test), it resulted in a TIFF with the first page only.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,027
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Linux User
Re: switch black and white in tiff files
« Reply #9 on: January 24, 2013, 06:27 AM »
Weird, I swear I saw an option for that in the batch processing dialog in plain XnView, but apparently not.  It is in XnViewMP though: http://newsgroup.xnview.com/viewtopic.php?f=60&t=26033 ;
From Tools -> Batch Convert, on the 'Output' tab, in the 'Multipage' group box, check the boxes next to "Convert multipage file to multipage file (when possible)" and "Convert all pages from multipage file".
All children left unattended will be given a mocha and a puppy.

IainB

  • @Slartibartfarst
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
Re: switch black and white in tiff files
« Reply #10 on: January 24, 2013, 08:28 AM »
@eleman: If your .tif/.tiff image file contains an image of white text on a black background, and you want it reversed, then I would suggest that you might consider turning the image into a negative (e.g., using irfanview or similar), which can then be saved as an image of black text on a white background.
That's what I have usually done in the past anyway.

You can print/output such image files as PDF files, and OCR them in the process, so you will have them as text-searchable and text copyable PDF files, which might be handy for searching/reading on a PCscreen, and could be easily printed as black-on-white hardcopy.

...I need to print them...
However, I have to ask: Why do you need to print them in hardcopy?
It does seem a backwards step.

Some alternatives:
  • 1. Windows 7 search/index: If the .tif/.tiff files were output from document scans, then whether the text is black on white or white on black should make little difference to an OCR scan. If you have any .tif/.tiff files on disk in Windows 7 (Home Premium), and if they are in a Library that the inbuilt index/search service has been assigned to watch, then the files will be automatically OCR scanned, and and any text in the images will be indexed and becomes text-searchable (but not text-copyable) - e.g., from the Start menu Search all programs and files.
  • 2. Google Drive: If you put the .tif/.tiff files into Google Drive, then the files will be automatically OCR scanned, and any text content will be indexed and made text-searchable and text-copyable. I use that facility all the time in Gdrive, and it seems to work very well.
  • 3. Qiqqa: If you output the image files as .PDF files, and if they were not OCR scanned, (or even if they were) then you could use the FREE version of the reference management system Qiqqa, which can automatically OCR scan PDF image files, and outputs indexed text-searchable and text-copyable PDF files. It is a superb information management tool.

Hope this helps or is useful.

eleman

  • Spam Killer
  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 413
Re: switch black and white in tiff files
« Reply #11 on: January 24, 2013, 08:47 AM »
...I need to print them...
However, I have to ask: Why do you need to print them in hardcopy?
It does seem a backwards step.

Court business. The documents must be printed and placed in dockets. And I will not attempt to reform Turkish civil procedure code at this time. Maybe later.

IainB

  • @Slartibartfarst
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
Re: switch black and white in tiff files
« Reply #12 on: January 24, 2013, 09:39 AM »
Court business. The documents must be printed and placed in dockets. And I will not attempt to reform Turkish civil procedure code at this time. Maybe later.
I should have known.    :(
No matter, I suggested some potentially useful options for getting what you need, with no extra cost or coding required, so you can probably get your B-on-W hardcopy no problem.

Original address: https://www.donationcoder.com/forum/index.php?topic=33774.0