{"id":29812,"date":"2019-04-23T20:29:30","date_gmt":"2019-04-23T12:29:30","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=29812"},"modified":"2019-04-22T21:58:31","modified_gmt":"2019-04-22T13:58:31","slug":"extract-text-from-images-imgclip","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/","title":{"rendered":"How to Extract Text from Images Using Command Line"},"content":{"rendered":"<p>It\u2019s easy enough to read an image and pull the text yourself. But <strong>dynamically pulling text<\/strong> from a photo is a bit tougher, and thankfully, <strong><a href=\"https:\/\/github.com\/Arthelon\/imgclip\" target=\"_blank\">imgclip<\/a><\/strong> offers a fairly simple solution.<\/p>\n<p>This <strong>command-line tool<\/strong> runs in the terminal for Mac, Windows, and Linux. It simply takes an argument for the image file along with the language, then <strong>returns the text<\/strong> copied to your clipboard.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/developers-command-line\/\">Why All Developers Should Learn Command Line<\/a>\n\t\t\t\t<\/p>\n<p>You can install the whole library via npm and it\u2019s a <strong>pretty simple install<\/strong>. The thing is <strong>only a few KB large<\/strong> and it comes with a JS file that you can browse on GitHub.<\/p>\n<p>Imgclip <strong>uses the <a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\" target=\"_blank\">Tesseract.js<\/a><\/strong> library for automating image processing and pulling text via <abbr title=\"Optical Character Recognition\">OCR<\/abbr>. It\u2019s one of the most powerful OCR libraries to date, and it\u2019s completely open source just like imgclip.<\/p>\n<p>I think I\u2019m most impressed with the quality and speed of this tool. It really does work to <strong>pull accurate text<\/strong> and it\u2019s one of the simplest tools to use.<\/p>\n<p>The imgclip command should be <strong>run directly in the terminal<\/strong>, followed by the relative path to the image. You can also add <strong>four options<\/strong> onto the end to customize the output.<\/p>\n<ol>\n<li><strong><code>-h<\/code>, <code>--help<\/code>:<\/strong> outputs usage information<\/li>\n<li><strong><code>-V<\/code>, <code>--version<\/code>:<\/strong> outputs the version number<\/li>\n<li><strong><code>-l<\/code>, <code>--lang<\/code>:<\/strong> outputs the language of the text in the image<\/li>\n<li><strong><code>-p<\/code>, <code>--print<\/code>:<\/strong> prints out the text in the image (instead of copying to clipboard)<\/li>\n<\/ol>\n<p>As of this writing, Tesseract <strong>supports <a href=\"https:\/\/github.com\/naptha\/tesseract.js\/blob\/master\/docs\/tesseract_lang_list.md\" target=\"_blank\">65 languages<\/a><\/strong> with more on the way. The code you append to the <code>--lang<\/code> tag should be whatever code is used in those Tesseract files.<\/p>\n<p>For example, <code>-l eng<\/code> will search the image for <strong>English text<\/strong>, while <code>-l jpn<\/code> will search for <strong>Japanese text<\/strong> and you can even run <code>-l jpn_vert<\/code> to search for <strong>vertically-oriented Japanese text<\/strong>.<\/p>\n<p>Since imgclip relies heavily on Tesseract, you basically have the power of that entire library at your disposal.<\/p>\n<p>To <strong>get started<\/strong>, visit the <a href=\"https:\/\/github.com\/Arthelon\/imgclip\" target=\"_blank\">GitHub page<\/a> and download a copy locally, or install it to a specific directory via npm. Then, you can run the tool in the terminal like an application to <strong>parse any image you want<\/strong>.<\/p>\n<p>To see <strong>imgclip in action<\/strong>, check out <a href=\"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl\" target=\"_blank\">this brief video<\/a> created as an imgclip demo.<\/p>\n<figure><a href=\"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl.png\" width=\"690\" alt=\"imgclip cli demo video\"><\/a><\/figure>","protected":false},"excerpt":{"rendered":"<p>It\u2019s easy enough to read an image and pull the text yourself. But dynamically pulling text from a photo is a bit tougher, and thankfully, imgclip offers a fairly simple solution. This command-line tool runs in the terminal for Mac, Windows, and Linux. It simply takes an argument for the image file along with the&hellip;<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3393],"tags":[3053,511],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Extract Text from Images Using Command Line - Hongkiat<\/title>\n<meta name=\"description\" content=\"It&#039;s easy enough to read an image and pull the text yourself. But dynamically pulling text from a photo is a bit tougher, and thankfully, imgclip offers a\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Extract Text from Images Using Command Line\" \/>\n<meta property=\"og:description\" content=\"It&#039;s easy enough to read an image and pull the text yourself. But dynamically pulling text from a photo is a bit tougher, and thankfully, imgclip offers a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-23T12:29:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl.png\" \/>\n<meta name=\"author\" content=\"Jake Rocheleau\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jake Rocheleau\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/\"},\"author\":{\"name\":\"Jake Rocheleau\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\"},\"headline\":\"How to Extract Text from Images Using Command Line\",\"datePublished\":\"2019-04-23T12:29:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/\"},\"wordCount\":360,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/asciinema.org\\\/a\\\/1n7wfprarthnh9htkavu3trkl.png\",\"keywords\":[\"Command Line\",\"Web Developers\"],\"articleSection\":[\"Toolkit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/\",\"name\":\"How to Extract Text from Images Using Command Line - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/asciinema.org\\\/a\\\/1n7wfprarthnh9htkavu3trkl.png\",\"datePublished\":\"2019-04-23T12:29:30+00:00\",\"description\":\"It's easy enough to read an image and pull the text yourself. But dynamically pulling text from a photo is a bit tougher, and thankfully, imgclip offers a\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#primaryimage\",\"url\":\"https:\\\/\\\/asciinema.org\\\/a\\\/1n7wfprarthnh9htkavu3trkl.png\",\"contentUrl\":\"https:\\\/\\\/asciinema.org\\\/a\\\/1n7wfprarthnh9htkavu3trkl.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/extract-text-from-images-imgclip\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Extract Text from Images Using Command Line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\",\"name\":\"Jake Rocheleau\",\"description\":\"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers\",\"sameAs\":[\"https:\\\/\\\/www.hongkiat.com\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/jake\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Extract Text from Images Using Command Line - Hongkiat","description":"It's easy enough to read an image and pull the text yourself. But dynamically pulling text from a photo is a bit tougher, and thankfully, imgclip offers a","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/","og_locale":"en_US","og_type":"article","og_title":"How to Extract Text from Images Using Command Line","og_description":"It's easy enough to read an image and pull the text yourself. But dynamically pulling text from a photo is a bit tougher, and thankfully, imgclip offers a","og_url":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2019-04-23T12:29:30+00:00","og_image":[{"url":"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl.png","type":"","width":"","height":""}],"author":"Jake Rocheleau","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Jake Rocheleau","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/"},"author":{"name":"Jake Rocheleau","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a"},"headline":"How to Extract Text from Images Using Command Line","datePublished":"2019-04-23T12:29:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/"},"wordCount":360,"commentCount":1,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#primaryimage"},"thumbnailUrl":"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl.png","keywords":["Command Line","Web Developers"],"articleSection":["Toolkit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/","url":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/","name":"How to Extract Text from Images Using Command Line - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#primaryimage"},"thumbnailUrl":"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl.png","datePublished":"2019-04-23T12:29:30+00:00","description":"It's easy enough to read an image and pull the text yourself. But dynamically pulling text from a photo is a bit tougher, and thankfully, imgclip offers a","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#primaryimage","url":"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl.png","contentUrl":"https:\/\/asciinema.org\/a\/1n7wfprarthnh9htkavu3trkl.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/extract-text-from-images-imgclip\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Extract Text from Images Using Command Line"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a","name":"Jake Rocheleau","description":"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers","sameAs":["https:\/\/www.hongkiat.com"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/jake\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-7KQ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29812","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=29812"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29812\/revisions"}],"predecessor-version":[{"id":47431,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29812\/revisions\/47431"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=29812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=29812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=29812"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=29812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}