{"id":9149,"library":"ocrmac","title":"ocrmac","description":"ocrmac is a Python wrapper designed to extract text from images specifically on macOS systems. It leverages Apple's Vision framework to provide fast and accurate Optical Character Recognition (OCR) capabilities. The library is currently at version 1.0.1 and maintains an active development and release cadence, with updates addressing features and bug fixes. It requires macOS 10.15 (Catalina) or newer.","status":"active","version":"1.0.1","language":"python","source_language":"en","source_url":"https://github.com/straussmaximilian/ocrmac","tags":["OCR","macOS","Apple Vision Framework","image processing"],"install":[{"cmd":"pip install ocrmac","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"CLI utilities","package":"click","optional":false},{"reason":"Image processing (PIL images)","package":"pillow","optional":false},{"reason":"Core dependency for macOS Vision framework integration","package":"pyobjc-framework-vision","optional":false}],"imports":[{"note":"Imports the main module, which contains the OCR class and helper functions.","symbol":"ocrmac","correct":"from ocrmac import ocrmac"},{"note":"Directly imports the OCR class for object-oriented usage.","symbol":"OCR","correct":"from ocrmac.ocrmac import OCR"}],"quickstart":{"code":"from ocrmac import ocrmac\nfrom PIL import Image\nimport os\n\n# Create a dummy image for demonstration purposes\ndummy_image_path = 'test_image.png'\nimg = Image.new('RGB', (60, 30), color = 'red')\nfrom PIL import ImageDraw, ImageFont\nd = ImageDraw.Draw(img)\ntry:\n    # Use a system font path for broader compatibility\n    font = ImageFont.truetype(\"/System/Library/Fonts/Supplemental/Arial.ttf\", 12)\nexcept IOError:\n    font = ImageFont.load_default() # Fallback\nd.text((10,10), \"Hello OCR!\", fill=(0,0,0), font=font)\nimg.save(dummy_image_path)\n\n# Perform OCR using the OCR class\ntry:\n    annotations = ocrmac.OCR(dummy_image_path, language_preference=['en-US']).recognize()\n    print(\"Detected annotations:\")\n    for text, confidence, bounding_box in annotations:\n        print(f\"  Text: '{text}', Confidence: {confidence:.2f}, Bounding Box: {bounding_box}\")\n\n    # Alternatively, use the functional interface\n    text_output = ocrmac.text_from_image(dummy_image_path, language_preference=['en-US'])\n    print(\"\\nDetected text (functional interface):\")\n    print(text_output)\n\nfinally:\n    # Clean up the dummy image\n    if os.path.exists(dummy_image_path):\n        os.remove(dummy_image_path)","lang":"python","description":"This quickstart demonstrates how to use `ocrmac` to extract text from an image. It covers both the class-based `ocrmac.OCR` approach and the functional `ocrmac.text_from_image` method, including setting language preferences. A dummy image is created for a runnable example."},"warnings":[{"fix":"Ensure deployment on a compatible macOS system (10.15 or newer).","message":"ocrmac is a macOS-exclusive library, relying on Apple's Vision framework. It will not function on Windows, Linux, or older macOS versions (requires macOS 10.15+).","severity":"breaking","affected_versions":"All versions"},{"fix":"Consult the `ocrmac` documentation or source code for a list of supported language codes (e.g., 'en-US', 'zh-Hans', 'de-DE').","message":"Using an unsupported or misspelled language code in `language_preference` will result in an error, often indicating available languages.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Choose the `recognition_level` ('fast' or 'accurate') that best suits your application's requirements for speed versus accuracy. Default is 'accurate'.","message":"The `recognition_level` parameter for OCR can be set to 'fast' or 'accurate'. 'Fast' provides quicker results but may sacrifice precision, while 'accurate' offers higher precision at a slower speed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When utilizing specific features or performance characteristics, ensure you explicitly set the `framework` parameter (e.g., `framework='livetext'`) in the `OCR` constructor or `text_from_image` function.","message":"ocrmac version 1.0.0 introduced support for using either the 'vision' or 'livetext' framework as the backend. Not specifying or incorrectly specifying the 'framework' parameter might lead to unexpected behavior or errors if you intend to use the newer LiveText features.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':39 '10.15':58 'accur':27 'activ':43 'address':50 'appl':19,64 'bug':53 'cadenc':47 'capabl':32 'catalina':59 'charact':29 'current':36 'design':7 'develop':44 'extract':9 'fast':25 'featur':51 'fix':54 'framework':22,66 'imag':12,67 'leverag':18 'librari':34 'maco':15,57,63 'maintain':41 'newer':61 'ocr':31,62 'ocrmac':1,2 'optic':28 'process':68 'provid':24 'python':5 'recognit':30 'releas':46 'requir':56 'specif':13 'system':16 'text':10 'updat':49 'version':38 'vision':21,65 'wrapper':6","created_at":"2026-04-16T18:48:43.309354+00:00","updated_at":"2026-04-16T18:48:43.309354+00:00","problems":{"verify_error":"× Failed to build `pyobjc-framework-coreml==12.2.1`\n  ├─▶ The build backend returned an error\n  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)\n\n      [stderr]\n      Traceback (most recent call last):\n        File \"<string>\", line 14, in <module>\n        File\n      \"/home/xor"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/straussmaximilian/ocrmac","docs":null,"changelog":null,"pypi":"https://pypi.org/project/ocrmac/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}