FunCaptcha Compare (Icon Matching)

FunCaptcha Compare widget

This type of FunCaptcha displays an image with a set of icons at the bottom and a reference set of icons at the top. Users need to match icons on the left side with the corresponding icons in the top-right set.
For example, the image may show fruit icons at the bottom and the same icons in a different order at the top-right. The user must select each matching icon correctly.

Like other image-based FunCaptcha, it can be solved via the universal separate API method based on tokens, it can also be solved via the universal Grid method.

The captcha image is divided into parts, and the solution result is returned as a list of selected tile indexes.

Returns an array of selected tile indexes, where 0 corresponds to the top-left corner of the grid.

  • Supported image formats: JPEG, PNG, GIF
  • Maximum file size: 600 kB
  • Maximum image size: 1000px on any side

GridTask Specification (FunCaptcha Compare)

Property Type Required Description
type String Yes Task type: GridTask
body String Yes Base64-encoded captcha image. Data-URI format (with data:content/type prefix) is also supported
rows Number No Number of rows in the grid
columns Number No Number of columns in the grid
comment String Yes* Instruction text for workers explaining how to solve the captcha correctly
imgInstructions String Yes* Instruction image for workers. Base64-encoded. Maximum size: 100 kB
minClicks Number No Minimum number of tiles that must be selected. Default: 1. Cannot exceed rows * columns
maxClicks Number No Maximum number of tiles that can be selected. Default: rows * columns
canNoAnswer Number No 0 — not allowed
1 — it is possible that no tiles match the instruction. Workers will see a "No matching images" button, and the response will return No_matching_images
previousId String No ID of your previous request for the same FunCaptcha task
imgType String No Used for accelerated recognition via Computer Vision. Supported values:
funcaptcha — FunCaptcha with tile clicking. Learn more.
funcaptcha_compare — FunCaptcha with icon matching / arrow-based selection. Learn more.
recaptcha — reCAPTCHA. Learn more.
Important: when using imgType, you must provide the comment in English and upload original image files (not screenshots).
  • You must provide either comment or imgInstructions.

Request Example (FunCaptcha Compare)

Method: createTask
API endpoint: https://api.2captcha.com/createTask

json Copy
{
    "clientKey": "key",
    "task": {
        "type": "GridTask",
        "body": "/9j/2wCEAAoHBwgHBgoICAgLCgoLDhgQDg0",
        "comment": "Match the icons on the left with the icons on the top faces of the dice (1 of 1)",
        "imgType": "funcaptcha_compare"
    }
}

Code Examples

php Copy
  // https://github.com/2captcha/2captcha-php

  require(__DIR__ . '/../src/autoloader.php');

  $solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');

  try {
      $result = $solver->grid('path/to/captcha.jpg', ['imgType' => 'funcaptcha_compare']);
  } catch (\Exception $e) {
      die($e->getMessage());
  }

  die('Captcha solved: ' . $result->code);
python Copy
# https://github.com/2captcha/2captcha-python

import sys
import os

sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from twocaptcha import TwoCaptcha

api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')

solver = TwoCaptcha(api_key)

try:
  result = solver.grid('path/to/captcha.jpg', imgType='funcaptcha_compare')

except Exception as e:
  sys.exit(e)

else:
  sys.exit('solved: ' + str(result))
csharp Copy
  // https://github.com/2captcha/2captcha-csharp

  using System;
  using System.Linq;
  using TwoCaptcha.Captcha;

  namespace TwoCaptcha.Examples
  {
      public class GridExample
      {
          public static void Main()
          {
              var solver = new TwoCaptcha("YOUR_API_KEY");
              Grid captcha = new Grid("path/to/captcha.jpg");
              captcha.ImgType = "funcaptcha_compare"; 
              try
              {
                  solver.Solve(captcha).Wait();
                  Console.WriteLine("Captcha solved: " + captcha.Code);
              }
              catch (AggregateException e)
              {
                  Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
              }
          }
      }
  }
java Copy
  // https://github.com/2captcha/2captcha-java

  package examples;

  import com.twocaptcha.TwoCaptcha;
  import com.twocaptcha.captcha.Grid;

  public class GridExample {
      public static void main(String[] args) {
          TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
          Grid captcha = new Grid("path/to/captcha.jpg");
          captcha.setImgType("funcaptcha_compare");
          try {
              solver.solve(captcha);
              System.out.println("Captcha solved: " + captcha.getCode());
          } catch (Exception e) {
              System.out.println("Error occurred: " + e.getMessage());
          }
      }

  }
go Copy
  // https://github.com/2captcha/2captcha-go

  package main

  import (
      "fmt"
      "log"
      "github.com/2captcha/2captcha-go"
  )

  func main() {
      client := api2captcha.NewClient("API_KEY")
      captcha := api2captcha.Grid{
          File: "/path/to/captcha.jpg",
          ImgType: "funcaptcha_compare",
      }

      code, err := client.Solve(captcha.ToRequest())
      if err != nil {
          log.Fatal(err);
      }
      fmt.Println("code "+code)
  }
ruby Copy
  require 'api_2captcha'

  client =  Api2Captcha.new("YOUR_API_KEY")

  result = client.grid({
    image: 'path/to/captcha.jpg',
    imgType: 'funcaptcha_compare'
  })