Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
tineye-services
Advanced tools
TinEye Services API node.js library for MatchEngine, MobileEngine, MulticolorEngine, and WineEngine
The TinEye Services libraries will not be maintained in the future. The current recommended best practice is to use an HTTP library such as Request. The TinEye Developer Documentation includes interactive Node.js code examples for all API calls to help you get started.
tineye-services is the official Node.js library for TinEye Services APIs, which includes MatchEngine, MobileEngine, MulticolorEngine and WineEngine. The Node library for the TinEye API can be found here.
Learn more at https://tineye.com
Official API documentation is available at https://services.tineye.com/docs
Install the latest version of the library using npm:
npm install tineye-services
After installing, require
the library to start using it:
const { MatchEngine } = require('tineye-services');
Now that you've required the library, you can use it to create an instance of the relevant API object. For example, if you're using MatchEngine and you want to add an image:
var matchengine = new MatchEngine('user_name', 'password', 'company_name');
// Sample image URL
var url = 'https://tineye.com/images/meloncat.jpg';
// Add an image to your index
// Required URL and optional remote file path
matchengine.add({url: url, filepath: 'image_name'}, function callback(err, data) {
if(!err)
console.log(data);
else
console.log(err.message);
});
Be sure to populate the user_name
, password
, company_name
and url
parameters with the appropriate
values for your API installation.
All TinEye Services accept these optional common parameters in addition to the parameters listed in the params object:
var params = {
format: 'xml', // Return will be in xml format, default is json
timeout: 100, // The call will timeout after timeout seconds. Set to 0 for no timeout.
};
TinEye Services APIs can only perform one add, delete or update operation at a time. Attempting to do multiple add, delete or update operations simultaneously will cause your performance to degrade. To achieve the best possible performance, we recommend using the async module to ensure that these operations are submitted in series.
For example:
// Array of images
var images = {
image1: {
imagePath: pathToImage1,
filePath: 'Image1'
},
image2: {
imagePath: pathToImage2,
filePath: 'Image2'
}
};
// Object to store results
var results = {};
// Use the async module to ensure images are submitted one at a time
async.forEachOfSeries(images, function (value, key, callback) {
multicolorengine.add({image:value.imagePath,filepath:value.filePath}, function (error, data) {
console.log(error, data);
if(data) {
results[key] = data;
callback();
}
else {
results[key] = error;
callback(err);
}
});
}, function (error) {
if(error)
console.log(error);
else
console.log(results);
});
To use MatchEngine, include tineye-services
and then create a MatchEngine
object using your
own user_name
, password
and company_name
:
const { MatchEngine } = require('tineye-services');
// URL is optional, if none is specified then default is https://multicolorengine.tineye.com/<company_name>/rest/
matchengine = new MatchEngine('user_name', 'password', 'company_name');
Please refer to the full MatchEngine documentation for more details.
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.url - Required
* @param params.filepath - Required
* @param callback
*/
var params = {
url: 'https://aurltoanimage.com/image.jpg',
filepath: 'path/to/store/image/on/server'
};
matchengine.add(params, function callback (err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// };
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.image - Required (path to local image)
* @param params.filepath - Optional
* @param callback
*/
var params = {
image: '/path/to/local/image.jpg',
filepath: 'path/to/store/image/on/server'
};
matchengine.add(params, function callback (err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// };
});
The compare operation requires that you submit two images. Each image can be submitted as a URL, image data or a filepath. The two images do not need to be submitted in the same method (for example, you can upload one image and use a filepath for the second).
/**
* Compare two images in collection
*
* @param params.url1 - Required (if no image1 or filepath1 included)
* @param params.image1 - Required (if no url1 or filepath1 included)
* @param params.filepath1 - Required (if no image1 or url1 included)
* @param params.url2 - Required (if no image2 or filepath2 included)
* @param params.image2 - Required (if no url2 or filepath2 included)
* @param params.filepath2 - Required (if no image2 or url2 included)
* @param params.min_score - Optional
* @param params.check_horizontal_flip - Optional
* @param params.generate_overlay - Optional
* @param params.enhanced_score - Optional
* @param params.color_compare - Optional
* @param callback
*/
var params = {
image1: '/path/to/local/image.jpg',
filepath2: 'path/to/image/on/server',
enhanced_score: true
};
matchengine.compare(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "compare",
// "result": [
// {
// "target_overlap_percent": 99.22,
// "query_overlap_percent": 98.59,
// "filepath": "match.jpg",
// "score_enhanced": 68.2,
// "score": 65.9,
// "match_percent": 92.11
// }
// ]
// }
});
/**
* Counts images in collection
* @param params - Common Parameters
* @param callback
*/
var params = {};
matchengine.count(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "count",
// "result": [
// 4
// ]
// }
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Delete an image from the collection
* @param params.filepath - Required
* @param callback
*/
var params = {
filepath: 'path/to/image/on/server'
};
matchengine.delete(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "delete",
// "result": []
// }
});
/**
* List images in collection
* @param params.offset - Optional
* @param params.limit - Optional
* @param callback
*/
var params = {};
matchengine.list(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "list",
// "result": [
// "melonCat",
// "limeCat.jpg",
// "meloncat.jpg",
// "image.jpg"
// ]
// }
});
/**
* Search images in collection
* @param params.url - Required (if no image or filepath included)
* @param params.image - Required (if no url or filepath included)
* @param params.filepath - Required (if no image or url included)
* @param params.offset - Optional
* @param params.limit - Optional
* @param params.min_score - Optional
* @param params.check_horizontal_flip - Optional
* @param params.generate_overlay - Optional
* @param params.enhanced_score - Optional
* @param callback - callback
*/
var params = {
url: 'https://aurltoanimage.com/image.jpg',
};
matchengine.search(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "search",
// "result": [
// {
// "match_percent": 89.52,
// "score": 97.2,
// "target_overlap_percent": 95.62,
// "query_overlap_percent": 72.37,
// "filepath": "path/folder/match1.png"
// },
// {
// "match_percent": 82.83,
// "score": 94.5,
// "target_overlap_percent": 87.13,
// "query_overlap_percent": 97.17,
// "filepath": "path/folder/match2.png"
// }
// ]
// }
});
/**
* Pings API
* @param callback
*/
matchengine.ping(function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "ping",
// "result": []
// }
});
To use MobileEngine, include tineye-services
and then create a MobileEngine
object using your
own user_name
, password
and company_name
:
const { MobileEngine } = require('tineye-services')
// URL is optional, if none is specified then default is https://mobileengine.tineye.com/<company_name>/rest/
mobileengine = new MobileEngine('user_name', 'password', 'company_name');
Please refer to the full MobileEngine documentation for more details.
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.url - Required
* @param params.filepath - Required
* @param callback
*/
var params = {
url: 'https://aurltoanimage.com/image.jpg',
filepath: 'path/to/store/image/on/server'
};
mobileengine.add(params, function callback (err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// }
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.image - Required(image path)
* @param params.filepath - Optional
* @param callback
*/
var params = {
image: '/path/to/local/image.jpg',
filepath: 'path/to/store/image/on/server'
};
mobileengine.add(params, function callback (err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// }
});
The compare operation requires that you submit two images. Each image can be submitted as a URL, image data or a filepath. The two images do not need to be submitted in the same method (for example, you can upload one image and use a filepath for the second).
/**
* Compare two images in collection
* @param params.url1 - Required (if no image1 or filepath1 included)
* @param params.image1 - Required (if no url1 or filepath1 included)
* @param params.filepath1 - Required (if no image1 or url1 included)
* @param params.url2 - Required (if no image2 or filepath2 included)
* @param params.image2 - Required (if no url2 or filepath2 included)
* @param params.filepath2 - Required (if no image2 or url2 included)
* @param params.min_score - Optional
* @param params.check_horizontal_flip - Optional
* @param params.generate_overlay - Optional
* @param params.enhanced_score - Optional
* @param params.color_compare - Optional
* @param callback
*/
var params = {
image1: '/path/to/local/image.jpg',
filepath2: 'path/to/image/on/server',
enhanced_score: true
};
mobileengine.compare(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "compare",
// "result": [
// {
// "target_overlap_percent": 99.22,
// "query_overlap_percent": 98.59,
// "filepath": "match.jpg",
// "listscore_enhanced": 68.2,
// "score": 65.9,
// "match_percent": 92.11
// }
// ]
// }
});
/**
* Counts images in collection
* @param params - Common Parameters
* @param callback
*/
var params = {};
mobileengine.count(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "count",
// "result": [
// 4
// ]
// }
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Delete an image from the collection
* @param params.filepath - Required
* @param callback
*/
var params = {
filepath: 'path/to/image/on/server'
};
mobileengine.delete(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "delete",
// "result": []
// }
});
/**
* List images in collection
* @param params.offset - Optional
* @param params.limit - Optional
* @param callback
*/
var params = {};
mobileengine.list(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "list",
// "result": [
// "melonCat",
// "limeCat.jpg",
// "meloncat.jpg",
// "image.jpg"
// ]
// }
});
/**
* Search images in collection
* @param params.url - Required (if no image or filepath included)
* @param params.image - Required (if no url or filepath included)
* @param params.filepath - Required (if no image or url included)
* @param params.offset - Optional
* @param params.limit - Optional
* @param params.min_score - Optional
* @param params.check_horizontal_flip - Optional
* @param params.generate_overlay - Optional
* @param params.enhanced_score - Optional
* @param callback
*/
var params = {
image: '/path/to/local/image.jpg',
};
mobileengine.search(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "search",
// "result": [
// {
// "match_percent": 89.52,
// "score": 97.2,
// "target_overlap_percent": 95.62,
// "query_overlap_percent": 72.37,
// "filepath": "path/folder/match1.png"
// },
// {
// "match_percent": 82.83,
// "score": 94.5,
// "target_overlap_percent": 87.13,
// "query_overlap_percent": 97.17,
// "filepath": "path/folder/match2.png"
// }
// ]
// }
});
/**
* Pings API
* @param params - Common Parameters
* @param callback
*/
mobileengine.ping(function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "ping",
// "result": []
// }
});
To use MulticolorEngine, include tineye-services
and then create a MulticolorEngine
object using your
own user_name
, password
and company_name
:
const { MulticolorEngine } = require('tineye-services');
// URL is optional, if none is specified then default is https://multicolorengine.tineye.com/<company_name>/rest/
multicolorengine = new MulticolorEngine('user_name', 'password', 'company_name');
Please refer to the full MulticolorEngine documentation for more information.
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.url - Required
* @param params.filepath - Required
* @param params.ignore_background - Optional
* @param params.ignore_interior_background - Optional
* @param params.metadata - Optional
* @param callback
*/
var params = {
url: 'https://aurltoanimage.com/image.jpg',
filepath: 'path/to/store/image/on/server'
};
multicolorengine.add(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// }
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.image - Required (path to local image)
* @param params.filepath - Optional
* @param params.ignore_background - Optional
* @param params.ignore_interior_background - Optional
* @param params.metadata - Optional
* @param callback
*/
var params = {
image: '/path/to/local/image.jpg',
filepath: 'path/to/store/image/on/server'
};
multicolorengine.add(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// }
})
/**
* Counts images in collection
* @param params - Common Parameters
* @param callback
*/
var params = {};
multicolorengine.count(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "count",
// "result": [
// 4
// ]
// }
});
/**
* Count colors from an image
*There are two ways to count image colors: images and urls
* @param images.images[] - Required (array of image paths)
* @param images.count_colors[] - Required
* @param images.ignore_background - Optional
* @param images.ignore_interior_background - Optional
* @param urls.urls[] - Required
* @param urls.count_colors[] - Required
* @param urls.ignore_background - Optional
* @param urls.ignore_interior_background - Optional
* @param callback
*/
var params = {
images:[
'local/path/to/image1.jpg',
'local/path/to/image2.jpg'
],
count_colors:[
'255,112,223',
'95,136,165',
'#DF4F23'
]
};
multicolorengine.countImageColors(params, function callback(err, data) {
// data ={
// "status": "ok",
// "error": [],
// "method": "count_image_colors",
// "result": [
// {
// "color": [
// 255,
// 112,
// 223
// ],
// "num_images_full_area": 0,
// "name": "Pale Magenta",
// "num_images_partial_area": 0,
// "class": "Violet"
// },
// {
// "color": [
// 95,
// 136,
// 165
// ],
// "num_images_full_area": 0,
// "name": "Air Force Blue",
// "num_ images_partial_area": 0,
// "class": "Blue"
// },
// {
// "color": "df4f23",
// "num_images_full_area": 1,
// "name": "Cinnabar",
// "num_images_partial_area": 1,
// "class": "Red"
// }
// ]
// }
});
/**
* There are 4 ways to count collection colors: collection, metadata, colors and filepaths
* @param collection.count_colors[] - Required
* @param metadata.metadata - Required
* @param metadata.count_colors[] - Required
* @param colors.colors[] - Required
* @param colors.weights[] - Required
* @param colors.count_colors[] - Required
* @param filepaths.filepaths[] - Required
* @param filepaths.count_colors[] - Required
* @param callback
*/
var params = {
count_colors: [
'255,112,223',
'95,136,165',
'#DF4F23'
]
};
multicolorengine.countCollectionColors(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "count_collection_colors",
// "result": [
// {
// "color": [
// 255,
// 112,
// 223
// ],
// "num_images_full_area": 1,
// "name": "Pale Magenta",
// "num_images_partial_area": 2,
// "class": "Violet"
// },
// {
// "color": [
// 95,
// 136,
// 165
// ],
// "num_images_full_area": 0,
// "name": "Air Force Blue",
// "num_images_partial_area": 0,
// "class": "Blue"
// },
// {
// "color": "df4f23",
// "num_images_full_area": 0,
// "name": "Cinnabar",
// "num_images_partial_area": 1,
// "class": "Red"
// }
// ]
// }
});
/**
* There are 4 ways to count collection colors: collection, metadata, colors and filepaths. See official documentation for more information on metadata queries.
* @param collection.count_metadata[] - Required
* @param metadata.metadata - Required
* @param metadata.count_metadata[] - Required
* @param metadata.min_score - Optional
* @param colors.colors[] - Required
* @param colors.weights[] - Required
* @param colors.count_metadata[] - Required
* @param colors.min_score - Optional
* @param filepaths.filepaths[] - Required
* @param filepaths.count_metadata[] - Required
* @param callback
*/
var params = {
count_metadata = {
"_or_operator_": [
{
"keywords":"dog"
},
{
"keywords":"cheetah"
}
]
}
};
multicolorengine.countMetadata(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "count_metadata",
// "result": [
// {
// "metadata": [
// {
// "count-metadata": {
// "count": "1",
// "": {
// "keywords": "dog"
// }
// }
// }
// ]
// }
// ]
// }
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Delete an image from the collection
* @param params.filepath - Required
* @param params - Common Parameters
* @param callback
*/
var params = {
filepath: 'path/to/image/on/server'
};
multicolorengine.delete(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "delete",
// "result": []
// }
})
/**
* There are 4 ways to extract collection colors: collection, metadata, colors and filepaths
* @param collection.count_colors[] - Required
* @param metadata.metadata - Required
* @param metadata.count_colors[] - Required
* @param colors.colors[] - Required
* @param colors.weights[] - Required
* @param colors.limit - Optional
* @param colors.color_format - Optional
* @param filepaths.filepaths[] - Required
* @param filepaths.limit - Optional
* @param filepaths.color_format - Optional
* @param callback
*/
var params = {
colors: ['212,123,225','126,135,150'],
weights: [70,30,],
limit: 50,
color_format: 'hex'
};
multicolorengine.extractCollectionColors(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "extract_collection_colors",
// "result": [
// {
// "color": [
// 141,
// 125,
// 83
// ],
// "weight": 76.37,
// "name": "Clay Creek",
// "rank": 1,
// "class": "Grey"
// },
// {
// "color": [
// 35,
// 22,
// 19
// ],
// "weight": 23.63,
// "name": "Seal Brown",
// "rank": 2,
// "class": "Black"
// }
// ]
// }
});
/**
* There are two ways to extract colors from an image: images and urls
* @param images.images[] - Required (array of image paths)
* @param images.ignore_background - Optional
* @param images.ignore_interior_background - Optional
* @param images.target_number_colors - Optional
* @param images.limit - Optional
* @param images.color_format - Optional
* @param urls.urls[] - Required (array of image urls)
* @param urls.ignore_background - Optional
* @param urls.ignore_interior_background - Optional
* @param urls.target_number_colors - Optional
* @param urls.limit - Optional
* @param urls.color_format - Optional
* @param callback
*/
var params = {
images: [
'local/path/to/image1.jpg',
'local/path/to/image2.jpg'
]
};
multicolorengine.extractImageColors(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "extract_image_colors",
// "result": [
// {
// "color": [
// 194,
// 66,
// 28
// ],
// "weight": 76.37,
// "name": "Rust",
// "rank": 1,
// "class": "Red"
// },
// {
// "color": [
// 141,
// 125,
// 83
// ],
// "weight": 23.63,
// "name": "Clay Creek",
// "rank": 2,
// "class": "Grey"
// }
// ]
// }
});
/**
* Get Metadata for collection images
* @param params.filepaths[] - Required
* @param callback
*/
var params = {
filepaths: [
'remote/path/to/image1.jpg',
'remote/path/to/image2.jpg'
]
};
multicolorengine.getMetadata(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "get_metadata",
// "result": []
// }
});
/**
* Get Return Metadata for collection images
* @param params - Common Parameters
* @param callback
*/
var params = {};
multicolorengine.getReturnMetadata(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "get_return_metadata",
// "result": [
// {
// "metadata": {
// "id": {
// "count": "2",
// "": null,
// "type": "uint"
// },
// }
// }
// ]
// }
});
/**
* Get Search Metadata for collection images
* @param params - Common Parameters
* @param callback
*/
var params = {};
multicolorengine.getSearchMetadata(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "get_search_metadata",
// "result": [
// {
// "metadata": {
// "keywords": {
// "count": "4",
// "type": "string",
// "": {
// "dog": {
// "count": "1",
// "": null
// },
// "cat": {
// "count": "1",
// "": null
// }
// //...
// }
// }
// }
// }
// ]
// }
});
/**
* List images in collection
* @param params.offset - Optional
* @param params.limit - Optional
* @param callback
*/
var params = {};
multicolorengine.list(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "list",
// "result": [
// "melonCat",
// "limeCat.jpg",
// "meloncat.jpg",
// "image.jpg"
// ]
// }
});
/**
* Search colors in collection
* @param params.url - Required (if no image or filepath included)
* @param params.image - Required (if no url or filepath included)
* @param params.filepath - Required (if no image or url included)
* @param params.colors[] - Required
* @param params.ignore_background - Optional
* @param params.ignore_interior_background - Optional
* @param params.metadata - Optional
* @param params.return_metadata - Optional
* @param params.sort_metadata - Optional
* @param params.weights[] - Optional
* @param params.limit - Optional
* @param params.min_score - Optional
* @param params.offset - Optional
* @param callback
*/
var params = {
image: '/path/to/local/image.jpg',
colors: ['#1abc9c']
};
multicolorengine.search(params, function callback(err, data) {
// data = {
// "count": "2",
// "status": "ok",
// "error": [],
// "method": "color_search",
// "result": [
// {
// "metadata-score": 3.0,
// "metadata": {
// "id": "67890"
// },
// "filepath": "path/folder/2.jpg"
// },
// {
// "metadata-score": 3.0,
// "metadata": {
// "id": "12345"
// },
// "filepath": "path/folder/1.jpg"
// }
// ]
// }
});
/**
* Pings API
* @param params - Common Parameters
* @param callback
*/
var params = {};
multicolorengine.ping(params, function(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "ping",
// "result": []
// }
});
/**
* Update Metadata for collection image
* @param params.filepath - Required
* @param params.metadata - Required
* @param params - Common Parameters
* @param callback
*/
params = {
filepath: 'path/to/image/on/server',
metadata: {
"price": {
"action": "mixed",
"type": "float",
"": "120.89"
}
}
};
multicolorengine.updateMetadata(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "update_metadata",
// "result": []
// }
});
To use WineEngine, include tineye-services
and then create a WineEngine
object using your
own user_name
, password
and company_name
:
const { WineEngine } = require('tineye-services');
// URL is optional, if none is specified then default is https://wineengine.tineye.com/<company_name>/rest/
wineengine = new WineEngine('user_name', 'password', 'company_name');
Please refer to the full WineEngine documentation for more information.
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.url - Required
* @param params.filepath - Optional
* @param callback
*/
var params = {
url: 'https://aurltoanimage.com/image.jpg',
filepath: 'path/to/store/image/on/server'
};
wineengine.add(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// }
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Add an image to an image collection
* @param params.image - Required(path to local file)
* @param params.filepath - Required
* @param callback
*/
var params = {
image: '/path/to/local/image.jpg',
filepath: 'path/to/store/image/on/server'
};
wineengine.add(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "add",
// "result": []
// }
});
/**
* Counts images in collection
* @param params - Common Parameters
* @param callback
*/
var params = {};
wineengine.count(params, function(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "count",
// "result": [
// 4
// ]
// }
});
Note: Only one image operation can be performed at a time (see Adding, deleting or updating images ).
/**
* Delete an image from the collection
* @param params.filepath - Required
* @param callback
*/
var params = {
filepath: 'path/to/image/on/server'
};
wineengine.delete(params, function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "delete",
// "result": []
// }
});
/**
* List images in collection
* @param params.offset - Optional
* @param params.limit - Optional
* @param callback
*/
var params = {};
wineengine.list(params, function callback(err, data) {
// data = {
// "status": "ok",
// "method": "list",
// "error": [],
// "result": [
// "path/folder/2.jpg",
// "path/folder/3.jpg"
// ]
// }
});
/**
* Search images in collection
* @param params.url - Required (if no image or filepath included)
* @param params.image - Required (if no url or filepath included)
* @param params.filepath - Required (if no image or url included)
* @param params.limit - Optional
* @param params.generate_overlay - Optional
* @param callback
*/
var params = {
filepath: 'path/to/image/on/server'
};
wineengine.search(params, function callback(err, data) {
// data = {
// "status": "ok",
// "method": "search",
// "error": [],
// "query_image": {
// "filepath": "query_image.jpg",
// "metadata": {
// "vintage_year": 2013,
// "vintage_rect": {
// "top": 364,
// "right": 277,
// "bottom": 391,
// "left": 237
// },
// "label_rect": {
// "top": 256,
// "right": 384,
// "bottom": 704,
// "left": 48
// }
// }
// },
// "result": [
// {
// "filepath": "h&b_label.jpg",
// "score": 34,
// "match_percent": 49.15,
// "query_overlap_percent": 49.35,
// "target_overlap_percent": 80.82,
// "overlay": "overlay/?query=query_image.jpg&target=h%26b_label.jpg&sc_2=0.625942& \
// tr_2_x=162.408&tr_2_y=534.414& fd_2_z=1262.32&fd_2_x=299.411&fd_2_y=342.536& \
// rot_1_y=-0.349066&rot_1_x=-0.523599&rot_1_z=0.0&rot_2_z=0.163794&rot_2_x=-0.599223& \
// rot_2_y=-0.282812&fd_1_y=480.25&fd_1_x=216.0&fd_1_z=784.5",
// "metadata": {
// "vintage_year": "2013",
// "vintage_rect": {
// "top": 151,
// "right": 354,
// "bottom": 192,
// "left": 288
// },
// "label_rect": {
// "top": 0,
// "right": 552,
// "bottom": 685,
// "left": 0
// }
// }
// }
// ]
// }
});
/**
* Pings API
* @param params - Common Parameters
* @param callback
*/
wineengine.ping(function callback(err, data) {
// data = {
// "status": "ok",
// "error": [],
// "method": "ping",
// "result": []
// }
});
Tests are run with mocha and stored in the tests folder.
Test must run on an empty collection of images.
To run the tests first install the dependencies.
npm install
Add test servers to the /test/testConfig.js file.
module.exports = {
MatchEngine: {
url: '<host>/rest/',
user: 'username',
pass: 'password',
companyName:''
},
MobileEngine:{
//...
}
};
Then run the tests using the below command.
npm test
FAQs
TinEye Services API node.js library for MatchEngine, MobileEngine, MulticolorEngine, and WineEngine
We found that tineye-services demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.