trying to get Horndude77's ruby logo removal script working

Advice and Help

Moderator: kcleung

Post Reply
kcleung
Copyright Reviewer
Posts: 127
Joined: Fri Sep 12, 2008 9:38 pm

trying to get Horndude77's ruby logo removal script working

Post by kcleung »

Hi!

I am running Ubuntu 8.10 on Intel quadcore

I have tried the script, and installed everything (ruby, rubygem, libleptonica 1.6, libtiff4 etc)
However when I try to run the script, the system seems to fail to find the TIFFFdOpen function despite libtiff4 is already installed

abc@Q6600:~/imslp/scripts$ ruby1.9 clean_om_pdf.rb
ruby1.9: symbol lookup error: /usr/lib/liblept.so: undefined symbol: TIFFFdOpen
abc@Q6600:~/imslp/scripts$

How can I get it working again?

ffi seems to be able to load only dynamic libraries (.so). for some reason, liblept (which calls the tiff functions) can't locate the function concerned.
horndude77
active poster
Posts: 293
Joined: Sun Apr 23, 2006 5:08 am
notabot: YES
notabot2: Bot
Location: Phoenix, AZ

Re: trying to get Horndude77's ruby logo removal script working

Post by horndude77 »

Yes, it's not straight forward unfortunately to create a working leptonica shared library. I haven't been able to get the standard leptonica shared library make target to work. So I just convert the .a file into a .so.

Code: Select all

ar -x liblept.a
gcc -shared -ltiff -ljpeg -lpng -lz  -lm *.o -o liblept.so.1.60
Also I haven't tested it yet with ruby 1.9, but I don't see why it wouldn't work.
kcleung
Copyright Reviewer
Posts: 127
Joined: Fri Sep 12, 2008 9:38 pm

Re: trying to get Horndude77's ruby logo removal script working

Post by kcleung »

Thanks! This is working now...... but I think we should update README so that users can get the script running properly.

The other problem is that my Ruby can't handle unicode:

For example in file_mapper.rb:

abc@Q6600:~/imslp/scripts$ ruby1.9 clean_om_pdf.rb BIZ01.pdf Cello
clean_om_pdf.rb:5:in `require': /home/abc/imslp/scripts/file_mapper.rb:184: invalid multibyte char (SyntaxError)
/home/abc/imslp/scripts/file_mapper.rb:184: invalid multibyte char
/home/abc/imslp/scripts/file_mapper.rb:184: syntax error, unexpected $end, expecting '}'
"suppco01.pdf" => "Suppé Poet and Peasant Overture",
^
from clean_om_pdf.rb:5:in `<main>'
abc@Q6600:~/imslp/scripts$
kcleung
Copyright Reviewer
Posts: 127
Joined: Fri Sep 12, 2008 9:38 pm

Re: trying to get Horndude77's ruby logo removal script working

Post by kcleung »

Oh, I found out that you need to add:

# encoding: utf-8

at the beginning of file_mapper.rb

then everything works
horndude77
active poster
Posts: 293
Joined: Sun Apr 23, 2006 5:08 am
notabot: YES
notabot2: Bot
Location: Phoenix, AZ

Re: trying to get Horndude77's ruby logo removal script working

Post by horndude77 »

I haven't looked into ruby 1.9 much yet so thanks for fixing that encoding gotcha. I'll fix this and the README later today.
Post Reply