News for hackers. Stuff that matters.
Re:Show HN: An API to extract texts from images and PDF files by zdw on Thursday July 18, 2013 @01:02PM (#6064911)
What's the benefit to using this over `pdftotext` and/or `pdfimages | convert | tesseract`?
Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @01:10PM (#6064967)
we think that's easier to integrate as there is nothing to install, nothing to maintain. We are also doing some pre/post processing which allow orientation detection for example. We also think that's might be useful for mobile as they are limited in resources. Also, on a PDF, we have an hybric way to perform both to not use slow OCR methods on easy to extract text but that's still quite a young product. New advanced features are coming.
Re:Show HN: An API to extract texts from images and PDF files by jingo on Thursday July 18, 2013 @02:43PM (#6065598)
The benefit is stamplin.com gets insight on what people are viewing and reading. They get to see what the user sees. They can compile a database and use or sell that information to be used for marketing purposes.

Also, it's an "API" (looks more like a url poiting to a CGI program to me, but whatever). API's are "cool" and "fun", while running local programs that you have control over is old and boring and not the future of computing.

Re:Show HN: An API to extract texts from images and PDF files by trez on Sunday July 21, 2013 @03:37AM (#6078177)
our API is quite new and we understand it doesn't give an outstanding value for everybody as it target easy of use for the moment but next release is going to add more advanced things.

About us using your data, our privacy policy will clarify that.

Re:Show HN: An API to extract texts from images and PDF files by angersock on Thursday July 18, 2013 @03:01PM (#6065699)
I have sought to answer exactly that question above.

:)

I love the happy little Unix-style legos of productivity.

Re:Show HN: An API to extract texts from images and PDF files by taf2 on Thursday July 18, 2013 @12:12PM (#6064586)
http://www.stamplin.com/api/ returns 403 when clicking on the API docs after confirming an account via email link
Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @12:37PM (#6064738)
sorry, the correct url is http://www.stamplin.com/api/docs/
Re:Show HN: An API to extract texts from images and PDF files by angersock on Thursday July 18, 2013 @02:54PM (#6065652)
I come bearing gifts, if anyone would like to host some of this themselves.

This follows the API documented by Stampin (minus the throttling errors)--it does not currently do the OCR, but as mentioned elsewhere by zdw you can probably get tesseract to get you like 80% of the way there. If you wanted to use that, you'd likely just replace the hacky `pdftotext` callout with your preferred toolchain.

You'll need Ruby, Sinatra, and the Xpdf tools, I believe.

Dual-licensed under the AGPL, BSD, and WTFPL licenses. idklol.

The code:

  require 'sinatra'
  require 'json'

  use Rack::Logger

  post '/extracttext' do

      begin
      status 204 and return unless params["file"] != nil

      type = params["type"] || "text"
      lang = params["lang"] || "en"

      tmpfilename = params["file"][:tempfile].path
      `pdftotext #{tmpfilename}`
      File.delete(tmpfilename)

      convfile = File.open("#{tmpfilename}.txt","r")
      lines = convfile.read.split("\n")
      convfile.close
      File.delete(convfile.path)

      content_type "application/json"
      {"text"=>lines}.to_json

      rescue
          status 500 and return
      end
  end
EDIT:

For God's sake run this in a jail and only on an internal network!

Re:Show HN: An API to extract texts from images and PDF files by rpedela on Thursday July 18, 2013 @11:15AM (#6064165)
I like the concept and it is a good start. Pulling text from PDFs is especially painful. I think the output format needs improvement. It is just a large array of strings. It seems like the strings are sometimes a single line, and sometimes not. My particular use case is extracting raw data from a PDF. I would like to see more structure to the output. For example, knowing where new lines, tabs, etc are located would be very helpful for parsing raw data.

Here is the PDF I used to test: https://www.gov.uk/government/uploads/system/uploads/attachm...

Is there a technical reason for the 1-2MB limit or is it arbitrary?

Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @11:23AM (#6064200)
Thanks for your comment!

That's something we can provide pretty easily and we would try to provide that in our next release. If you want us to help you with your specific problem, please send us an email at [email protected].

The limit has been set to prevent our server from crashing as we do not have, for the moment, the financial capability to support a massive server farm. Again, if this limit prevent you from using our API, we might move the limit up if you ask it by email.

Re:Show HN: An API to extract texts from images and PDF files by mappum on Thursday July 18, 2013 @04:07PM (#6066107)
The OCR is really useless. I tested it with some reddit "advice animal" memes (because there is a need for transcriptions). You would think that text is pretty simple and easy, but the output I got was like:

    /\n\nnmrs wn\ufb02qyi mm mm\nTlIIEI\ufb02|\ufb02llllM\u2018l co
Re:Show HN: An API to extract texts from images and PDF files by trez on Friday July 19, 2013 @01:27AM (#6068476)
Sorry that didn't work properly for you. We are working on improving our OCR results quality. Could you please send us at [email protected] the file you used to get this useless result?
Re:Show HN: An API to extract texts from images and PDF files by gkoberger on Thursday July 18, 2013 @02:15PM (#6065398)
The upgrade button doesn't work, and nobody is going to hover long enough to see the "Not Available Yet" title. And the current 10 requests isn't even enough to test with.

I'm excited to try this.. so figure out a way to take my money soon.

Re:Show HN: An API to extract texts from images and PDF files by gnosis on Thursday July 18, 2013 @10:58AM (#6064046)
This looks nice except for having to depend on your servers as a middle man.

Any chance you could release the code as Free or open source so that its users can use it standalone on their own machines?

Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @11:10AM (#6064138)
That's not planned at the moment but if we wouldn't find a way to monetize it, we would do it for sure.
Re:Show HN: An API to extract texts from images and PDF files by RivieraKid on Thursday July 18, 2013 @12:52PM (#6064838)
Why would someone want to use an API instead of a library?
Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @01:12PM (#6064977)
some langages might not have an appropriate library, some might want to not have heavy processes on their device (mobiles). We also think that's easier to use as there is nothing to install. That mainly depends on your case.
Re:Show HN: An API to extract texts from images and PDF files by RivieraKid on Thursday July 18, 2013 @01:22PM (#6065054)
I agree that there might situations where it can be useful, but:

1) Mobiles have pretty good CPUs. I think uploading and waiting for response would be slower and less reliable.

2) If the mobile user doesn't have an internet connection, the app won't work.

3) As a developer, I would be dependant on an external service, that could stop working someday.

Re:Show HN: An API to extract texts from images and PDF files by rpedela on Thursday July 18, 2013 @11:17AM (#6064178)
Can I assume API keys are on the roadmap? I don't particularly like using my username and password.
Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @11:26AM (#6064227)
Yes, we'd like to increase security on each releases. It should be available in one of the next release.
Re:Show HN: An API to extract texts from images and PDF files by rpedela on Thursday July 18, 2013 @11:28AM (#6064252)
Great!
Re:Show HN: An API to extract texts from images and PDF files by antrover on Thursday July 18, 2013 @11:43AM (#6064355)
Nice. Are you using the Tessaract OCR lib at the core of the extraction?
Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @11:44AM (#6064370)
yes we do
Re:Show HN: An API to extract texts from images and PDF files by it_learnses on Thursday July 18, 2013 @12:51PM (#6064827)
Any custom requests? Let us *know.
Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @01:13PM (#6064982)
thx, I am gonna fix that
Re:Show HN: An API to extract texts from images and PDF files by trez on Friday July 19, 2013 @02:07AM (#6068576)
fixed
Re:Show HN: An API to extract texts from images and PDF files by smougel on Thursday July 18, 2013 @10:46AM (#6063967)
Any Feedback Welcomed
Re:Show HN: An API to extract texts from images and PDF files by sebg on Thursday July 18, 2013 @10:58AM (#6064047)
Looks good - does it do data tables? That's a big issue and something I've heard about (run into) many times...
Re:Show HN: An API to extract texts from images and PDF files by trez on Thursday July 18, 2013 @11:28AM (#6064242)
Thanks for your comment! We would really appreciate if you could explain us in more details problems you faced. I am sending you an email if that's ok for you to discuss that.
Re:Show HN: An API to extract texts from images and PDF files by sebg on Thursday July 18, 2013 @11:54AM (#6064440)
responded to your email. good luck.