{"id":28969964,"url":"https://github.com/astro-gram/img2txt-python-package","last_synced_at":"2025-07-11T13:34:35.349Z","repository":{"id":299165714,"uuid":"1002215791","full_name":"Astro-gram/img2txt-python-package","owner":"Astro-gram","description":"This Python package allows a you to access the img2txt.io API a clean interface.","archived":false,"fork":false,"pushed_at":"2025-06-15T17:56:31.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-24T10:12:33.648Z","etag":null,"topics":["image","image-processing","img2txt","python"],"latest_commit_sha":null,"homepage":"https://img2txt.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Astro-gram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-15T01:04:04.000Z","updated_at":"2025-06-15T17:56:34.000Z","dependencies_parsed_at":"2025-06-15T04:28:03.909Z","dependency_job_id":"bb861914-d479-4496-8c08-e2f12897ada5","html_url":"https://github.com/Astro-gram/img2txt-python-package","commit_stats":null,"previous_names":["astro-gram/img2txt-python-package"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Astro-gram/img2txt-python-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astro-gram%2Fimg2txt-python-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astro-gram%2Fimg2txt-python-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astro-gram%2Fimg2txt-python-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astro-gram%2Fimg2txt-python-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Astro-gram","download_url":"https://codeload.github.com/Astro-gram/img2txt-python-package/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astro-gram%2Fimg2txt-python-package/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264821806,"owners_count":23669295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image","image-processing","img2txt","python"],"created_at":"2025-06-24T10:12:28.778Z","updated_at":"2025-07-11T13:34:35.299Z","avatar_url":"https://github.com/Astro-gram.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# img2txt.io Python Package\n\nA Python Package for the [img2txt.io](https://img2txt.io) API. Easily upload images and convert them to plain text or structured output programmatically.\n\n## Installation\n\n```bash\npip install img2txtio\n```\n\nOr install directly from source:\n\n```bash\ngit clone https://github.com/Astro-gram/img2txt-python-package.git\ncd img2txt-python-sdk\npip install .\n```\n\n## Quick Start\n\n```python\nfrom img2txtio import Img2TxtClient\n\n# Initialize client with your API key\ntoken = \"YOUR_API_KEY_HERE\"\nclient = Img2TxtClient(api_key=token)\n\n# Convert an image to plain text\nresult = client.process(\n    image_path=\"path/to/image.jpg\",\n    output_type=\"raw\",           # default: raw text\n    description=\"Receipt from grocery\",  # optional\n    outputStructure=\"\"           # optional JSON string for structured output\n)\n\n# `result` is a dict containing the API response\nprint(result)\n```\n\n## API Reference\n\n### Class: `Img2TxtClient`\n\n#### `__init__(api_key: str)`\n\nCreate a new client instance.\n- `api_key` (str): Your img2txt.io API key. You can generate one from the [img2txt.io dashboard](https://img2txt.io/dashboard?api-settings=true).\n\n#### `process(image_path: str, output_type: str = \"raw\", description: str = \"\", outputStructure: str = \"\") -\u003e dict`\n\nUploads the image at `image_path` and converts it to text or structured output.\n\nParameters:\n\n- `image_path` (str): Local path to the image file. Must exist, otherwise raises `FileNotFoundError`.\n- `output_type` (str): The output format. Defaults to `raw`. Other valid types depend on the API (e.g., `json`, `structured`).\n- `description` (str): Optional description or context to improve text extraction.\n- `outputStructure` (str): Optional JSON string defining a structure/schema for the output. Must be valid JSON or raises `ValueError`.\n\nReturns:\n\n- `dict`: Parsed JSON response from the API. On failure, raises `RuntimeError`.  \n- Example response:\n    ```python\n    {\n        'text_output': [\n            'Los Angeles', 'Florida', '$235', 'Round trip', 'Economy',\n            '1 passenger', 'Lowest total price'\n        ],\n        'job_id': '16e2364a-e1e2-468e-9be9-e07b695b2afd',\n        'creditsLeft': 86.115,\n        'success': True,\n        'message': 'Image processed successfully.'\n    }\n    ```\n\n\n## Error Handling\n\n- Network or HTTP errors raise `requests.exceptions.HTTPError`.\n- Missing files raise `FileNotFoundError`.\n- Invalid JSON in `outputStructure` raises `ValueError`.\n- API failures raise `RuntimeError`.\n\n## License\n\nThis project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastro-gram%2Fimg2txt-python-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastro-gram%2Fimg2txt-python-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastro-gram%2Fimg2txt-python-package/lists"}