Batch Image Processing from local folder using Imagga API

Batch Upload of Photos for Image Recognition

This blog post is part of series on How-Tos for those of you who are not quite experienced and need a bit of help to set up and use properly our powerful image recognition APIs.

In this one we will help you to batch process (using our Tagging or Color extraction API) a whole folder of photos, that reside on your local computer. To make that possible we’ve written a short script in the programming language Python:

Feel free to reuse or modify it. Here’s a short explanation what it does. The script requires the Python package requests, which you can install using this guide.

It uses requests’ HTTPBasicAuth to initialize a Basic authentication used in Imagga’s API from a given API_KEY and API_SECRET which you have to manually set in the first lines of the script.

There are three main functions in the script – upload_image, tag_image, extract_colors.

    • upload_image(image_path) – uploads your file to our API using the content endpoint, the argument image_path is the path to the file in your local file system. The function returns the content id associated with the image.
  • tag_image(image, content_id=False, verbose=False, language=‘en’) – the function tags a given image using Imagga’s Tagging API. You can provide an image url or a content id (from upload_image) to the ‘image’ argument but you will also have to set content_id=True. By setting the verbose argument to True, the returned tags will also contain their origin (whether it is coming from machine learning recognition or from additional analysis). The last parameter is ‘language’ if you want your output tags to be translated in one of Imagga’s supported 50 (+1) languages. You can find the supported languages from here –
  • extract_colors(image, content_id=False) – using this function you can extract colors from your image using our Color Extraction API. Just like the tag_image function, you can provide an image URL or a content id (by also setting content_id argument to True).

Script usage:

Note: You need to install the Python package requests in order to use the script. You can find installation notes here.

You have to manually set the API_KEY and API_SECRET variables found in the first lines of the script by replacing YOUR_API_KEY and YOUR_API_SECRET with your API key and secret.

Usage (in your terminal or CMD):

python <input_folder> <output_folder> –language=<language> –verbose=<verbose> –merged-output=<merged_output> –include-colors=<include_colors>

The script has two required – <input_folder>, <output_folder> and four optional arguments – <language>, <verbose>, <merged_output>, <include_colors>.

  • <input_folder> – required, the input folder containing the images you would like to tag.
  • <output_folder> – required, the output folder where the tagging JSON response will be saved.
  • <language>optional, default: en, the output tags will be translated in the given language (a list of supported languages can be found here:
  • <verbose>optional, default: False, if True the output tags will contain an origin key (whether it is coming from machine learning recognition or from additional analysis)
  • <include_colors>optional, default: False, if True the output will also contain color extraction results for each image.
  • <merged_output>optional, default: False, if True the output will be merged in a JSON single file, otherwise – separate JSON files for each image.

Multi Language Support – Imagga API

Language support Imagga Image Recogniton

We are happy to announce we are adding 50 languages (still in beta) to Imagga Auto-tagging and Categorization APIs. The tags/categories that the powerful Imagga image recognition API returns now speak your language.  All you need to do is to add the language parameter with corresponding language code you want the results to be displayed in. You can even add multiple languages (for example &language=de&language=fr).

Currently there are 50 languages supported with the following language codes: ar (Arabic), bg (Bulgarian), bs (Bosnian), ca (Catalan), cs (Czech), cy (Welsh), da (Danish), de (German), el (Greek), es (Spanish), et (Estonian), fa (Persian), fi (Finnish), fr (French), he (Hebrew), hi (Hindi), hr (Croatian), ht (Haitian Creole), hu (Hungarian), id (Indonesian), it (Italian), ja (Japanese), ko (Korean), lt (Lithuanian), lv (Latvian), ms (Malay), mt (Maltese), mww (Hmong Daw), nl (Dutch), no (Norwegian), otq (Querétaroo Otomi), pl (Polish), pt (Portuguese), ro (Romanian), ru (Russian), sk Slovak), sv (Swedish), sl (Slovenian), sr_cyrl (Serbian – Cyrillic), sr_latn (Serbian – Latin), th (Thai), tlh (Klingon), tlh_qaak (Klingon (pIqaD)), tr (Turkish), uk (Ukrainian), ur (Urdu), vi (Vietnamese), yua (Yucatec Maya), zh_chs (Chinese Simplified), zh_cht (Chinese Traditional)

Find out how to implement in Imagga API Docs.

You can see how auto-tagging and the language support works live on our demo page.

Not finding yours in the supported languages list? Talk to us.


Analyzing Text and Images: Webinar

Webinar S4 Imagga

Happy to announce an upcoming webinar together with our platform partners Ontotext. The webinar on Self-Service Semantic Suite (S4) will take place on Nov 12th (11am ET / 8am PT / 4pm GMT) featuring Ontotext CTO, Marin Dimitrov as well as a guest speaker Georgi Kadrev, CEO of Imagga.

S4 provides on demand access to text mining and linked open data technology in the cloud. Using the platform you can quickly and easily build smart data prototypes at a fraction of the cost of enterprise solutions.

Georgi (@imagga) of Imagga will be covering the newly available image analytics capabilities into  Ontotext’s Self-Service Semantic Suite (S4) platform. Thanks to powerful Imagga auto tagging & categorization API, S4 users will get more insights not just from the text but also from images on the web pages they need to analyze.

Marin (@marin_dim) from Ontotext will be covering some new exciting features of Ontotext Semantic Suite as improvements of the RDF graph database-as-a-service, new Python SDK for S4 as well as Product roadmap and new features currently in development.

Don’t miss the opportunity to learn about the Self-Service Semantic Suite (S4) – register for this event now!


Imagga among the 40 winners of UN-based World Summit Award 2015

Imagga @ World Summit Award

Imagga was selected as one of the winners of the World Summit Award, a global initiative in cooperation of the United Nations World Summit on the Information Society (WSIS) and UNESCO, UNIDO and UN GAID. WSA is the only ICT event worldwide, that reaches the mobile community in over 178 countries.

Imagga Image Recognition PaaS will be honored to receive the Award in e-Media & Journalism category in front of UN representatives, ICT ministries and the private sector at the World Summit Global Congress in Shenzhen, China, in February 2016.

“It’s extremely exciting to see two Bulgarian companies – Imagga (e-Media & Journalism category) and Bee Smart (e-Health and Environment category) as finalists of the World Summit Award 2015. Having two winning teams happens for the first time since Bulgaria participates in the prestigious award”, states Pavel Vurbanov, European Software Institute – Center Eastern Europe.

The 40 winners representing 24 countries were carefully selected from 386 nominations. The goal of the award is to showcase the world’s best practices in digital innovation – from Japan to Brazil and from Norway to Australia.

The WSA winners were selected by a jury of international ICT experts in two democratic rounds. Each UN Member State is eligible to nominate one product per category for the World Summit Award. This way any nomination results from a national pre-selection prior to the international WSA Jury.

Imagga Gets Big Players Award by HM King of Spain at South Summit 2015

Georgi Kadrev getting Tech for Big Players Award from HM Felipe VI, King of Spain

Georgi Kadrev getting Tech for Big Players Award from HM Felipe VI, King of Spain

Imagga was honored to get Tech for Big Players Award at South Summit 2015, that took place in Madrid, Spain. At the closing day HM Felipe VI, King of Spain himself awarded the finalists of the startup competition at the event and spent some time to talk with the winning companies. Out of the four startups being recognized at the event, Imagga is the only company that doesn’t come from Spanish speaking country.

South Summit is the leading entrepreneurship event for the Spanish speaking world. Over 12,500 participants, 100 startups, 650  investors, 325 journalists и 275 speakers took place in the forum, held in the historic Las Ventas building – build in the beginning of 20 century and home of the famous bull fights. Special guest of the event was Steve Wozniak, co-founder of Apple together with Steve Jobs.

Imagga was one of the 100 carefully selected startups from 15 countries (3 companies in total from Bulgaria) and we competed in Tech for Big Players category (the other categories were; digital solutions for the mass market, healthcare and biotech, industrial revolution)

“Being able to stand and pitch on the very same arena famous for bullfighting actually raised the adrenalin and made the experience quite unique. It was great opportunity to meet fellow entrepreneurs, talk image recognition and AI, currently quite hot trends, and talk to investors and media”, shares Georgi Kadrev, co-founder and CEO of Imagga.


Imagga’s automated tagging is getting traction and we see great use cases and lots of business opportunities. South Summit opened up a new world of possibilities as we’ve never been that much focused on the Spanish speaking world, but we see it’s big and interesting.

“I took some time to contemplate why I like this tree as a prize that much – it’s not just because it was given by His Majesty the King of Spain and is the symbol of Madrid, but also as it is a very beautiful metaphor – it has been planted some time ago, and it took a while before it shows up above the ground. Now it’s grown but it’s still small and it still needs care until it grows and give some sweet fruits. I believe it’s the same with our Imagga.”, shares Georgi Kadrev

Being part of SouthSummit was fun and very rewarding. Thanks for inspiring us and at the same time acknowledging our efforts to democratize image recognition and make it useful for great variety of business use cases.

Imagga at Hack The Visual

Hack the Visual event in London. Shot for Canon Europe Ltd.

Hack the Visual event in London. Shot for Canon Europe Ltd.

During the last couple years we’ve been taking part in numerous hackathons and events. Hack The Visual was perfect fit for what we do at Imagga. The goal of the event is to connect different types of visual data to each other and create new and interesting prospective. All data is welcomed – pictures, music, video, geo-data, even open data, you name it. In just 48 hours over 100 participants were hacking on projects mashing existing APIs and data sets to find a solution for a real life visual problem.

The main challenge was to bring together photos, videos and other kind of imagery with hardware, interfaces, platforms, apps & services in order to unlock the next step in visual culture.

Tree main tracks have been set based on research by Imaging Mind (organizer of the event) regarding the future of imaging:

  • meshed capture – connecting multiple camera sources to generate new experiences. Winner: Camera Crowd – combining multiple photos and their location data with a photo of the area you are. A mesh of pictures from different sources blended into the space
  • new perspectives/interpretation of images – accessing various image data sets to extract value from them outside of the image itself. Winner: Hear The Picture – by linking each coloured pixel to its individual sound, a photo could be ‘heard’ through its own distinctive soundtrack
  • interactive visuals – reworking the static images into interactive new experience. Winner: Sharon – watch the same video source with multiple people, and allow synced manipulation of the video

Grand Prize went to Splatmap – web application that allows you to photograph buildings with your smartphone and plot the information into the application.

Hack the Visual event in London. Shot for Canon Europe Ltd.

The special Imagga API prize went to Remember – app that triggers your memories using your own photo collection. Re/Visit a place and Remember will remind you of pictures you or someone else snapped nearby. It can also search for relevant photos based on the topics in the photo (using Imagga’s image recognition tagging API), turning your photo library into a smart conversation starter wherever you might be.

Overall, great event! See you next time. And do not forget to give Imagga APIs a try!

Machine Learning Meetup in Sofia

ML Meetup Sofia

Three year ago when we publicly talked about machine learning, deep learning, convolutional neural networks and AI not many people were getting it. It was hard to explain what all this is about. Things have changed, and for good.

Last week we’ve invited a bunch of people to Machine Learning meetup. The first in Sofia. 60 people attended and it was awesome. It’s awesome to see so many people interested in AI and machine learning. And they were getting it. We are sure machine learning will be widely adopted in many tech verticals  in an year or so and are proud to be helping Bulgarian AI/ML community to exchange ideas and grow.

Judging by the number of people and cases that has been discussed, lots of startups are already exploring the power of machine learning in various industries – e-commerce, bitcoin landing, real estate, to mention few. It’s still the early days of ML community in Sofia, so we’ve started with some basics. Judging by the variety of the questions after our short intro presentation, next editions of Sofia Machine Learning Meetup will be quite geeky and interesting.

Some More Image Recognition Tests, Some More Great Results

Yesterday we tested Imagga’s deep learning algorithms against 6 others. The results were quite good and we believe our tech is doing an amazing job recognizing everyday objects with impressive accuracy.

Looks like there’s another interesting test of various image recognition technologies, this time performed by Jack Clark for Bloomberg Business with several challenging images.

It’s quite fascinating to run the same images, the author has originally used, via the Imagga image tagging demo to find out how we perform as well. Imagga tech definitely thinks Mark Zuckerberg is more than a cardigan, but still tags him with а few trivial words (see the results below). May be the subtitle of the article would be different if Imagga’s image tagging was considered, but the ‘Best answer’ section would be a bit boring 😉

Let’s have some fun now (feel free to use Imagga auto-tagging demo to test with your own images):


Imagga: food

Best answer: Fat (Clarifai)
Worst answer: Slug/Churros (MetaMind, demo version)


Imagga: business

Best answer: Cloth/Zuckerberg (Orbeus)
Worst answer: Cardigan (MetaMind, demo version)


Imagga: cat

Best answer: Cat—everyone got this. After all, the Internet is made of cats.


Imagga: mountain

Best answer: Mountain (Orbeus)
Worst answer: Vehicle/Scene (IBM Watson Visual Recognition, beta version)


Imagga: keyboard

Best answer: Technology (Clarifai)
Worst answer: Photo/Object (IBM Watson Visual Recognition, beta version)


Imagga: rocket

Best answer: Missile (MetaMind, demo version)
Worst answer: Blue/Plane (Orbeus)

Have an amazing idea but felt sceptical about image recognition? Give Imagga’s super easy to use API a try and you’ll change your mind :)

Imagga and 6 alternative image recognition services

In a recent post on the newly introduced component of Wolfram’s language for image identification ImageIdentify Jordan Novet of Venture Beat conducted a quick test of ImageIdentify against 5 deep learning platforms for image recognition he chose. He selected “10 images from Flickr that seemed to clearly fall into the 1,000 categories used for the 2014 ImageNet visual recognition competition.” and tagged them with ImageIdentify and 5 alternative image recognition services.

As one of the very first platforms as a service, offering such functionality worldwide, we felt we should join this funny experiment and make our humble contribution, by adding the tags Imagga’s image recognition technology generated for the same 10 photos. You can try with your own photos using Imagga online image recognition demo.

We better leave the results speak for themselves. Please take all this with a grain of salt and don’t forget that these results are obtained for just 10 randomly selected photos :)

1. Coffee Mug

Coffee mug

Imagga: cup, mug, coffee mug, drinking vessel, beverage, punch, container, coffee, drink, vessel

Wolfram ImageIdentify: tea
CamFind: white ceramic mug
Clarifai: coffee cup nobody tea mug cafe hot ceramic coffee cup cutout
MetaMind: Coffee mug
Orbeus: cup
AlchemyAPI: coffee

2. Mushroom


Imagga: vegetable, produce, mushroom, food, fungus, cap, organic, lush, moss, forest

Wolfram ImageIdentify: magic mushroom
CamFind: white mushroom
Clarifai: mushroom fungi fungus toadstool nature grass fall moss forest autumn
MetaMind: Mushroom
Orbeus: fungus
AlchemyAPI: mushroom

3. Spatula


Imagga: microphone, spatula, business, turner, black, device, knife, technology, hand, cooking utensil

Wolfram ImageIdentify: spatula
CamFind: black kitchen turner
Clarifai: steel wood knife handle iron fork equipment nobody tool chrome
MetaMind: spatula
Orbeus: tool
AlchemyAPI: knife

4. Scoreboard


Imagga: signboard, scoreboard, board

Wolfram ImageIdentify: scoreboard
CamFind: baseball scoreboard
Clarifai: scoreboard soccer stadium football game competition goal group north america match
MetaMind: Scoreboard
Orbeus: billboard
AlchemyAPI: sport

5. German Shepherd

German Shepherd

Imagga: shepherd dog, german shepherd, dog, canine, domestic animal, kelpie, doberman, pinscher, pet, animal

Wolfram ImageIdentify: German shepherd
CamFind: black and brown German shepherd
Clarifai: dog canine cute puppy mammal loyalty grass sheepdog fur German hepherd
MetaMind: German Shepherd, German Shepherd Dog, German Police Dog, Alsatian
Orbeus: animal
AlchemyAPI: dog

6. Toucan


Imagga: volleyball, ball, people, man, black, racket, body, person, game equipment, equipment (nice try)

Wolfram ImageIdentify: tufted puffin
CamFind: toucan bird
Clarifai: bird one north america nobody animal people adult nature two outdoors
MetaMind: toucan
Orbeus: animal
AlchemyAPI: sport

7. Indian Cobra

Indian cobra

Imagga: Indian cobra, cobra, snake, thunder snake

Wolfram ImageIdentify: black-necked cobra
CamFind: brown and beige cobra snake
Clarifai: snake nobody reptile cobra wildlife daytime sand rattlesnake north america desert
MetaMind: Indian cobra, Naja Naja
Orbeus: animal
AlchemyAPI: snake

8. Strawberry


Imagga: berry, strawberry, fruit, edible fruit, produce, food, strawberries, juicy, sweet, dessert

Wolfram ImageIdentify: strawberry
CamFind: red strawberry ruit
Clarifai: fruit sweet food strawberry ripe juicy berry healthy isolated delicious
MetaMind: strawberry
Orbeus: strawberry
AlchemyAPI: berry

9. Wok


Imagga: plate, pan, wok, china, porcelain, food, dinner, cooking utensil, utensil, delicious

Wolfram ImageIdentify: cooking pan
CamFind: gray steel frying pan
Clarifai: ball nobody pan cutout kitchenware north america tableware competition bowl glass
MetaMind: wok
Orbeus: frying pan
AlchemyAPI: (No tags)

10. Shoe store

Shoe store

Imagga: black, symbol, business, food, design, pattern, sign, art, traditional

Wolfram ImageIdentify: store
CamFind: black crocs
Clarifai: colour street people color car mall road fair architecture hotel
MetaMind: Shoe Shop, Shoe Store
Orbeus: shoe shop
AlchemyAPI: sport

The fun part aside, we are quite interested to see soon a more comprehensive subjective and objective evaluation of all these services, including Imagga, with their pros and cons, on more representative and rich datasets, and depending on the way the tags will be used in different verticals and applications.

Competition is an important driver for every industry, so we are more than open to participate in such kinds of service comparisons and may even initiate such a comparison in the very near future.


Uploading image files for auto-tagging with Imagga API using the PHP SDK

Imagga Image Tagging

Uploading images to Imagga API is one of the most common tasks you need to figure out in order to get advantage of the power of automated image tagging. In the following tutorial we will guide your through the aspects of doing exactly this with the help of our PHP SDK.

Have in mind that the following blog post assumes you have at least basic knowledge of PHP.

Step 1: Find your API credentials.

If you don’t have an account yet, just create one, it’s really simple. And we have a free plan too.

The first thing you need to do in order to be able to use the API is find your credentials. They are included in both the sign up email we have sent you and at the bottom left corner of your Imagga account dashboard.

Screen Shot 2015-04-28 at 7.27.08 PM

Now when you know where to find these, you need to download the PHP SDK. Go to our documentation and under the “Client Libraries” section click on  Screen Shot 2015-04-28 at 7.08.54 PM  to begin downloading the archive, containing the SDK. Unzip it, open the folder “imagga_php_sdk” and create a new file named config.php with the following content:


$config = array(
    'api_key' => 'XXXXXXX',
    'api_secret' => 'XXXXXXX'


where instead of the “X”-es you should place your api key and api secret.

Now it’s time to continue with the real usage of the API. Let’s create another file to contain our code for uploading and auto-tagging images. Create a file named “index.php” (you might actually call it whatever you’d like but mind the extension .php) and continue to the next step.

Step 2: Include the Imagga PHP SDK and your configuration.

Open the newly created file and require the PHP SDK first along with the configuration file you have created in the previous steps.

require_once "lib/Imagga.php";
require_once “config.php”;

Step 3: Create an API Client instance.

The object we would use to call Imagga API should be a Client instance. You can create one by invoking the Client constructor with your api key as a first parameter and your api secret as a second (we have these in our config.php file, remember?).

$client = new \Imagga\Imagga\Client($config['api_key'], $config['api_secret']);

Now, when we have our client initialized, we can move on to making some API calls.

Step 4: Upload an image to Imagga API and submit it for auto-tagging.

In order to perform auto-tagging with Imagga API and the PHP SDK on an image file, you should first upload it and then send the result of the upload (if it is successful) for tagging.

Upload the image to the content endpoint (it is preferable to use absolute paths instead of relative ones).

Uploading an image file to Imagga API is achieved by calling the `uploadContent` method on our client instance with the path to the local file you would like to submit.

$local_image = 'example_photo.jpg';
$local_image_path = __DIR__ . '/' . $local_image;
$content_response = $client->uploadContent($local_image_path);

Now when you have the content response, go through the results returned by the getResults method and invoke the tagging on each of them.

foreach ($content_response->getResults() as $contentResult)
    $tagging_response = $client->tagging($contentResult);

Check for errors

If a request to the API was not successful, you can get information about the errors by calling the getErrors method on the tagging response. If there aren’t any errors this method will return false, otherwise you will get an array of Error objects. You can go through each of them and display the error message with the getMessage method.

if ($tagging_response->getErrors())
    foreach ($tagging_response->getErrors() as $err)
        echo 'Error: '. $err->getMessage() . ', status code: ' . $err->getStatusCode();

You can also submit an image URL for tagging with the PHP SDK and it’s really simple. We will briefly cover it in the next additional section.

Step 5: Output the image tags

If there aren’t any errors, we can continue by displaying the result of the tagging. Just iterate through the elements given by the getResults method and display the suggested tags. You can get a list of all the tags by calling the getTagsLabels method on a tagging result.

foreach ($tagging_response->getResults() as $taggingResult)
    echo '<img src="'.$taggingResult->getImage().'" />';
    echo '<p>' . implode(', ', $taggingResult->getTagsLabels()) . '</p>';

Additional: Auto-tagging an image by sending a publicly accessible URL

Have in mind though that this won’t work for localhost URLs as they aren’t seen by the internet.

The only difference is that instead of a content endpoint result object as first parameter to the tagging method you should give it a publicly accessible image URL.

Request tags using the image URL

$tagging_response = $client->tagging('');

Now you can check for errors and extract the tagging results as outlined in the previous steps of the tutorial.

And that’s it.

If you have any questions and/or suggestions feel free to use the comments section.

For those of you who would just like to use the code right-away, here it follows. Make sure to comment out the parts you do not intend to use. For example if you would like to try the auto-tagging by uploading an image file, remove the part which does tagging by URL or vice-versa.

The code for config.php:

//Use your real credentials here
$config = array(
    'api_key' => 'XXXXXXX',
    'api_secret' => 'XXXXXXX'

The code for index.php:


//Include the Imagga PHP SDK
require_once "lib/Imagga.php";
require_once “config.php”;

//Create an instance of the Imagga client
$client = new \Imagga\Imagga\Client($config['api_key'], $config['api_secret']);

//Request tags for an image, using an url
$tagging_response = $client->tagging('');

//Check for errors
if ($tagging_response->getErrors())
    foreach ($tagging_response->getErrors() as $err)
        echo 'Error: '. $err->getMessage() . ', status code: ' . $err->getStatusCode();

//Output the resulting tags
foreach ($tagging_response->getResults() as $taggingResult)
    echo '<img src="'.$taggingResult->getImage().'" />';
    echo '<p>' . implode(', ', $taggingResult->getTagsLabels()) . '</p>';

//Upload a local image to the content endpoint
$local_image = 'example_photo.jpg';
$local_image_path = __DIR__ . '/' . $local_image;
$content_response = $client->uploadContent($local_image_path);

//Use the provided content response results to tag an image instead of an url
foreach ($content_response->getResults() as $contentResult)
    $tagging_response = $client->tagging($contentResult);

    //Check for errors
    if ($tagging_response->getErrors())
       foreach ($tagging_response->getErrors() as $err)
           echo 'Error: '. $err->getMessage() . ', status code: ' . $err->getStatusCode();

    //Output the results
    foreach ($tagging_response->getResults() as $taggingResult)
        echo '<img src="'.$local_image.'" />';
        echo '<p>' . implode(', ', $taggingResult->getTagsLabels()) . '</p>';