Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
.. image:: https://img.shields.io/pypi/v/google_drive_ocr?color=success :target: https://pypi.python.org/pypi/google_drive_ocr
.. image:: https://readthedocs.org/projects/google-drive-ocr/badge/?version=latest :target: https://google-drive-ocr.readthedocs.io/en/latest/?version=latest :alt: Documentation Status
.. image:: https://img.shields.io/pypi/pyversions/google_drive_ocr :target: https://pypi.python.org/pypi/google_drive_ocr :alt: Python Version Support
.. image:: https://img.shields.io/github/issues/hrishikeshrt/google_drive_ocr :target: https://github.com/hrishikeshrt/google_drive_ocr/issues :alt: GitHub Issues
.. image:: https://img.shields.io/github/followers/hrishikeshrt?style=social :target: https://github.com/hrishikeshrt :alt: GitHub Followers
.. image:: https://img.shields.io/twitter/follow/hrishikeshrt?style=social :target: https://twitter.com/hrishikeshrt :alt: Twitter Followers
Perform OCR using Google's Drive API v3
GoogleOCRApplication()
for use in projectsmultiprocessing
)Create a :code:GoogleOCRApplication
application instance:
.. code-block:: python
from google_drive_ocr import GoogleOCRApplication
app = GoogleOCRApplication('client_secret.json')
Perform OCR on a single image:
.. code-block:: python
app.perform_ocr('image.png')
Perform OCR on mupltiple images:
.. code-block:: python
app.perform_batch_ocr(['image_1.png', 'image_2.png', 'image_3.png'])
Perform OCR on multiple images using multiple workers (:code:multiprocessing
):
.. code-block:: python
app.perform_batch_ocr(['image_1.png', 'image_3.png', 'image_2.png'], workers=2)
Typical usage with several options:
.. code-block:: console
google-ocr --client-secret client_secret.json \
--upload-folder-id <google-drive-folder-id> \
--image-dir images/ --extension .jpg \
--workers 4 --no-keep
Show help message with the full set of options:
.. code-block:: console
google-ocr --help
Configuration ^^^^^^^^^^^^^
The default location for configuration is :code:~/.gdo.cfg
.
If configuration is written to this location with a set of options,
we don't have to specify those options again on the subsequent runs.
Save configuration and exit:
.. code-block:: console
google-ocr --client-secret client_secret.json --write-config ~/.gdo.cfg
Read configuration from a custom location (if it was written to a custom location):
.. code-block:: console
google-ocr --config ~/.my_config_file ..
Performing OCR ^^^^^^^^^^^^^^
Note: It is assumed that the :code:client-secret
option is saved in configuration file.
Single image file:
.. code-block:: console
google-ocr -i image.png
Multiple image files:
.. code-block:: console
google-ocr -b image_1.png image_2.png image_3.png
All image files from a directory with a specific extension:
.. code-block:: console
google-ocr --image-dir images/ --extension .png
Multiple workers (:code:multiprocessing
):
.. code-block:: console
google-ocr -b image_1.png image_2.png image_3.png --workers 2
PDF files:
.. code-block:: console
google-ocr --pdf document.pdf --pages 1-3 5 7-10 13
Note:
You must setup a Google application and download :code:client_secrets.json
file before using :code:google_drive_ocr
.
Create a project on Google Cloud Platform
Wizard: https://console.developers.google.com/start/api?id=drive
Instructions:
* https://cloud.google.com/genomics/downloading-credentials-for-api-access
* Select application type as "Installed Application"
* Create credentials OAuth consent screen --> OAuth client ID
* Save :code:`client_secret.json`
FAQs
Perform OCR using Google's Drive API v3
We found that google-drive-ocr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.