Page 1 of 1 1
Topic Options
#207852 - 2013-10-04 02:47 PM Scanned documents in .TIF format .. tricky question
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hi guys,

this might get another unsolved question:
OS is W2K3 SE Server SP2. I don't have to but would like to programmatically find out the amount of pages a scanned document in .TIF format has.

I guess it might get tricky up to near unsolvable as explorer holds no value for 'pages'
_________________________



Top
#207853 - 2013-10-04 03:03 PM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Oh and, if there is a solution, idk, ActiveX or whatever, it should be able to handle the Info for 600k + files in finite time
_________________________



Top
#207854 - 2013-10-04 05:20 PM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
The Extended File Property PAGES is honored by PDFs but it doesn't appear to honor TIF, maybe there is another property that will though.

GetExtFileProperties() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=160880#Post160880

Also, here is a utility (never personally used it)
http://www.tucows.com/preview/517262/Tiff--PDF-Page-Counter-FREEWARE


Top
#207855 - 2013-10-04 05:37 PM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
why not just pure kix ;\)

 Code:
function tiffPageCount($filePath)
dim $oFo,$sFi
 $filePath=split($filePath,'\')
 $sFi=$filePath[ubound($filePath)]
 $filePath[ubound($filePath)] = ''
 $oFo = CreateObject("Shell.Application").namespace(join($filePath,'\'))
 $tiffPageCount = $oFo.GetDetailsOf($oFo.Parsename($sFi),13)
endfunction


COMPLETELY untested. written in the quick edit window, so use at own risk \:\)
_________________________
!

download KiXnet

Top
#207856 - 2013-10-04 06:14 PM Re: Scanned documents in .TIF format .. tricky question [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
If all else fails, you could convert the Tiffs to PDF with something like ImageMagick and then use the ext file property of PAGES.

http://www.imagemagick.org/script/index.php

Top
#207857 - 2013-10-04 06:39 PM Re: Scanned documents in .TIF format .. tricky question [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
umm .. nope .. can't do that Allen. But thanx a bunch anyway.

@Joeel: eh, will test that one fo sure

edit: hey, thats almost the same as Allens published udf .. SO, why not just test both ..

as said, it will be a nice to have if it doesn't kill me on the runtime side (as said, the amount of files to be touched is 600k+


Edited by Jochen (2013-10-04 06:44 PM)
Edit Reason: Yay @Allen
_________________________



Top
#207859 - 2013-10-05 02:00 AM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if it works, the code can be easily modified to go for the folder and do for each $file in $folder.items

that should give a bit of speed and since we are talking about 6000000 files, all speed is good speed ;\)
_________________________
!

download KiXnet

Top
#207863 - 2013-10-06 09:56 AM Re: Scanned documents in .TIF format .. tricky question [Re: Lonkero]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ok,

not even remotely successfull .. no pages returned for tif \:\(

@Allen: very useful udf you got there though .. thx for the complete attribute list. *sigh* ;\)
_________________________



Top
#207864 - 2013-10-06 04:23 PM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
I found a solution using Powershell. If you have seen my posts in the Com forum, we can access powershell through a com call/dll. The only way i have seen it work though is it counts the pages of all the tifs in a directory. I tried and tried to get it to work with one file, with no success. Any interest in this?
Top
#207866 - 2013-10-07 04:51 PM Re: Scanned documents in .TIF format .. tricky question [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
why would it work any better with powershell? I mean, cool if you did, but I just can't see how powershell has more knowledge than windows shell?

anyways, tiff utils (http://www.remotesensing.org/libtiff/)
should have a solution for this, but it is file by file...
win32 binaries are available from http://gnuwin32.sourceforge.net/packages/tiff.htm

and the util you would be interested is tiffinfo.exe
_________________________
!

download KiXnet

Top
#207867 - 2013-10-07 05:07 PM Re: Scanned documents in .TIF format .. tricky question [Re: Lonkero]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hi guys,

I wouldn't complain if it was whole directory or file by file as long as I can distinguish between the files.

@Allen: yes, I found your Powershell post (and read it back in 2007).. samples are always welcome. Registering/installing stuff on the platform I have to use is a nogo though.
@Jooel: will try the tool you linked me to as well.

Thank you guys.
_________________________



Top
#207869 - 2013-10-07 05:16 PM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
No cigar for tiffinfo.exe:

 Code:
D:\Data\Scripts\KiXtart>tiffinfo.exe WelcomeFax.tif
TIFF Directory at offset 0x1869c (99996)
  Subfile Type: (0 = 0x0)
  Image Width: 816 Image Length: 1056
  Resolution: 96, 96 pixels/inch
  Bits/Sample: 8
  Compression Scheme: LZW
  Photometric Interpretation: RGB color
  Samples/Pixel: 3
  Rows/Strip: 5
  Planar Configuration: single image plane
  Predictor: none 1 (0x1)


Pages? Naaaah \:D
_________________________



Top
#207870 - 2013-10-07 05:37 PM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Jochen, you happen to have a multi page tiff you dont mind uploading to play around with?
Top
#207871 - 2013-10-07 05:52 PM Re: Scanned documents in .TIF format .. tricky question [Re: ShaneEP]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
It looks like there may be a way to crawl through the file looking at the IFDs. There is 1 IFD for every page.
Top
#207872 - 2013-10-07 05:54 PM Re: Scanned documents in .TIF format .. tricky question [Re: ShaneEP]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
The -D option will force tiffinfo to read and decompress all the data in a file (but not display it).

http://renderman.pixar.com/resources/current/rps/tiffinfo.1.html
_________________________
!

download KiXnet

Top
#207882 - 2013-10-08 02:53 AM Re: Scanned documents in .TIF format .. tricky question [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
Powershell has access to .net... you know, the thing we keep asking for?
Top
#207883 - 2013-10-08 11:11 AM Re: Scanned documents in .TIF format .. tricky question [Re: Allen]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
Have you tried tiffdump ?

http://www.davince.com/docs/tiffdump.html

Cheers,
_________________________
Bill

Top
#207936 - 2013-10-24 04:08 PM Re: Scanned documents in .TIF format .. tricky question [Re: BillBarnard]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hi guys,
thanx for all your replies so far..

Well, plan has been changed in the mean time, files will be converted to pdf/a format before Mig.. so all efforts were useless m/

Thx @all, case rested.
_________________________



Top
#208195 - 2013-12-23 11:54 PM Re: Scanned documents in .TIF format .. tricky question [Re: Jochen]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Found this page; http://www.lfd.uci.edu/~gohlke/

And this tifffile.py;
http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html


Here be binaries for winblows:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#vlfd

Don't have any TIFF's to try it out on tho.
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 778 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.118 seconds in which 0.086 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org