LISTSERV mailing list manager LISTSERV 16.5

Help for CODE4LIB Archives


CODE4LIB Archives

CODE4LIB Archives


CODE4LIB@LISTS.CLIR.ORG


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

CODE4LIB Home

CODE4LIB Home

CODE4LIB  May 2014

CODE4LIB May 2014

Subject:

Re: Extracting Text From .tiff Files

From:

Gavin Spomer <[log in to unmask]>

Reply-To:

Code for Libraries <[log in to unmask]>

Date:

Tue, 13 May 2014 12:39:28 -0700

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (164 lines)

Thanks Alexander, that was helpful. 

I should've explained the format of the tiff files better. You can see what I'm working with by downloading one: 

   http://digital.lib.cwu.edu/studentnewspaper/RCDATA01/waelcnp0/20130627/00002138/00000001.tif  

There's a few lines of "crud" followed by about 80 lines of XML (but this doesn't contain the text I want) followed by the text I want (generally one word per line, with bits of "crud" mixed in, LOL) followed by a few thousand lines of more "crud". (graphic data, I assume). 

I tried using the exiftool to try to extract it, but still not supplying the correct options or it's not working: 

   # exiftool -Exif_0x1638 -charset exif=UTF8 00000001.tif  
   # exiftool -Exif_0x1638 -charset exif=Latin 00000001.tif  
   # exiftool -Exif_0x1637 -charset exif=UTF8 00000001.tif  
   # exiftool -Exif_0x1637 -charset exif=Latin 00000001.tif  
   # exiftool -Exif_0x1639 -charset exif=UTF8 00000001.tif  
   # exiftool -Exif_0x1639 -charset exif=Latin 00000001.tif  
   # exiftool -Exif_0x1639 -charset exif=ASCII 00000001.tif 

Anyways, I just RE-tried using php now that I have a better perspective and was able to extract exactly what I want (crud-free) with: 

<?php 
$exif = exif_read_data('00000001.tif', 'IFD0'); 
print preg_replace('/\n/', ' ', $exif['UndefinedTag:0x1638']); 
?> 

Thanks to everyone who offered their help. 


- Gavin 


>>> Alexander Duryee <[log in to unmask]> 5/13/2014 10:40 AM >>>
Gavin,

It looks like ExifTool is extracting the XML metadata, but isn't
translating it into ASCII - 60 63 120 109 108 is the "<?xml" header, and
I'm sure that the rest of those values are the fulltext that you're looking
for.  According to the FAQ (
http://www.sno.phy.queensu.ca/~phil/exiftool/faq.html), the --charset
exif=CHARSET will tell it to convert to your character set of choice.

Regards,
Alex


On Tue, May 13, 2014 at 1:29 PM, Gavin Spomer <[log in to unmask]> wrote:

> Thanks for the suggestion. I have it downloaded and installed on my test
> server and have run it with various options on one of the tiff files Even
> if this doesn't work for me, what a fantastic tool; I may have applications
> for it later. :)
>
> Can't seem to get the text out of the tiff file though. Here's what I was
> able to get:
>
> # exiftool -a -u 00000001.tif
> ExifTool Version Number         : 9.60
> File Name                       : 00000001.tif
> Directory                       : .
> File Size                       : 936 kB
> File Modification Date/Time     : 2013:07:17 15:59:31-07:00
> File Access Date/Time           : 2014:05:13 10:07:30-07:00
> File Inode Change Date/Time     : 2014:04:30 09:24:55-07:00
> File Permissions                : rw-r--r--
> File Type                       : TIFF
> MIME Type                       : image/tiff
> Exif Byte Order                 : Little-endian (Intel, II)
> Subfile Type                    : Full-resolution Image
> Image Width                     : 4802
> Image Height                    : 7189
> Bits Per Sample                 : 1
> Compression                     : T6/Group 4 Fax
> Photometric Interpretation      : WhiteIsZero
> Fill Order                      : Normal
> Document Name                   : The Observer
> Strip Offsets                   : (Binary data 195 bytes, use -b option to
> extract)
> Orientation                     : Horizontal (normal)
> Samples Per Pixel               : 1
> Rows Per Strip                  : 256
> Strip Byte Counts               : (Binary data 166 bytes, use -b option to
> extract)
> X Resolution                    : 300
> Y Resolution                    : 300
> Page Name                       : 1
> T6 Options                      : (none)
> Resolution Unit                 : inches
> Software                        : ResCarta SDK v3.1.6
> Modify Date                     : 2013:06:28 19:13:26
> Exif 0x1637                     : 60 63 120 109 108 32 118 101 114 115 105
> 111 110 61 34 [...]
> Exif 0x1638                     : 226 128 162 97 108 117 10 67 101 110 116
> 114 97 108 10 [...]
> Exif 0x1639                     : 133 156 203 142 38 57 110 133 247 245 44
> 57 64 232 70 7[...]
> Image Size                      : 4802x7189
>
> Not sure any of this helps me.
>
>
> - Gavin
>
>
> >>> "Reser, Gregory" <[log in to unmask]> 5/12/2014 3:30 PM >>>
> You might try http://www.sno.phy.queensu.ca/~phil/exiftool/ , a Perl
> library to read and write embedded metadata.
>
> Greg Reser
> UC San Diego Library
> 9500 Gilman Drive, 0175K
> La Jolla, CA 92093-0175
>
> Phone: 858.246.0998
> Skype: gregreser
>
>
>
> -----Original Message-----
> From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of
> Stuart Yeates
> Sent: Monday, May 12, 2014 3:26 PM
> To: [log in to unmask]
> Subject: Re: [CODE4LIB] Extracting Text From .tiff Files
>
> Your first step is to pin down the format. TIFF is a container form (like
> zip) and can contain pretty much anything. Likely candidates for you format
> include https://en.wikipedia.org/wiki/IPTC_Information_Interchange_Modeland
> https://en.wikipedia.org/wiki/Extensible_Metadata_Platform
>
> Your second step is to find a library / tool for your platform that
> supports your format.
>
> Cheers
> stuart
>
> -----Original Message-----
> From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of
> Gavin Spomer
> Sent: Tuesday, 13 May 2014 10:01 a.m.
> To: [log in to unmask]
> Subject: [CODE4LIB] Extracting Text From .tiff Files
>
> Hello folks,
>
> I'm in the process of migrating a student newspaper collection, currently
> implemented with ResCarta, into our new bepress institutional repository.
> ResCarta has each page of a newspaper stored as a tiff file. Not only does
> the tiff file contain the graphics data, but it has some metadata in xml
> format and the fulltext of the page. I know this because I opened up some
> of the tiffs with a plain-text editor (Vim).
>
> Although I can see the text in the file, I've only been about 90% accurate
> in extracting it with a script. Some of those "weird" characters seem to do
> some wonky things when doing file IO for some reason. Is there a more
> reliable way to extract text stored in a tiff file? I've Googled and
> Googled and have pulled up almost nothing. But there's got to be a way,
> since ResCarta stores it there and can extract it.
>
> Any ideas?
> Gavin Spomer
> Systems Programmer
> Brooks Library
> Central Washington University
>

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003

ATOM RSS1 RSS2



LISTS.CLIR.ORG

CataList Email List Search Powered by the LISTSERV Email List Manager