Vectorizer.AI API एक पूर्ण बिटमैप ट्रेसिंग प्रदान करता है। API पूरी तरह से स्वचालित रूप से और सर्वोत्तम श्रेणी में पिक्सल को वैक्टर में ट्रेस करता है।
एक बिटमैप इमेज पोस्ट करें और एक वैक्टरीकृत परिणाम वापस प्राप्त करें:
$ curl https://hi.vectorizer.ai/api/v1/vectorize \ -u xyz123:[secret] \ -F image=@example.jpeg \ -o result.svg
// Requires: org.apache.httpcomponents.client5:httpclient5-fluent Request request = Request.post("https://hi.vectorizer.ai/api/v1/vectorize") .addHeader("Authorization", "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd") .body( MultipartEntityBuilder.create() .addBinaryBody("image", new File("example.jpeg")) // TODO: Replace with your image // TODO: Add more upload parameters here .build() ); ClassicHttpResponse response = (ClassicHttpResponse) request.execute().returnResponse(); if (response.getCode() == 200) { // Write result to disk, TODO: or wherever you'd like try (FileOutputStream out = new FileOutputStream("result.svg")) { response.getEntity().writeTo(out); } } else { System.out.println("Request Failed: Status: " + response.getCode() + ", Reason: " + response.getReasonPhrase()); }
using (var client = new HttpClient()) using (var form = new MultipartFormDataContent()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "INSERT_API_KEY_HERE"); form.Add(new ByteArrayContent(File.ReadAllBytes("example.jpeg")), "image", "example.jpeg"); // TODO: Replace with your image // TODO: Add more upload parameters here var response = client.PostAsync("https://hi.vectorizer.ai/api/v1/vectorize", form).Result; if (response.IsSuccessStatusCode) { // Write result to disk, TODO: or wherever you'd like FileStream outStream = new FileStream("result.svg", FileMode.Create, FileAccess.Write, FileShare.None); response.Content.CopyToAsync(outStream).ContinueWith((copyTask) => { outStream.Close(); }); } else { Console.WriteLine("Request Failed: Status: " + response.StatusCode + ", Reason: " + response.ReasonPhrase); } }
// Requires "request" to be installed (see https://www.npmjs.com/package/request) var request = require('request'); var fs = require('fs'); request.post({ url: 'https://hi.vectorizer.ai/api/v1/vectorize', formData: { image: fs.createReadStream('example.jpeg'), // TODO: Replace with your image // TODO: Add more upload options here }, auth: {user: 'xyz123', pass: '[secret]'}, followAllRedirects: true, encoding: null }, function(error, response, body) { if (error) { console.error('Request failed:', error); } else if (!response || response.statusCode != 200) { console.error('Error:', response && response.statusCode, body.toString('utf8')); } else { // Save result fs.writeFileSync("result.svg", body); } });
$ch = curl_init('https://hi.vectorizer.ai/api/v1/vectorize'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd')); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'image' => curl_file_create('example.jpeg'), // TODO: Add more upload options here )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch); if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) { // Save result file_put_contents("result.svg", $data); } else { echo "Error: " . $data; } curl_close($ch);
# Either use the sample code below, or this SDK: https://pypi.org/project/vectorizer-ai/ # Requires "requests" to be installed (see https://pypi.org/project/requests/) import requests response = requests.post( 'https://hi.vectorizer.ai/api/v1/vectorize', files={'image': open('example.jpeg', 'rb')}, data={ # TODO: Add more upload options here }, auth=('xyz123', '[secret]') ) if response.status_code == requests.codes.ok: # Save result with open('result.svg', 'wb') as out: out.write(response.content) else: print("Error:", response.status_code, response.text)
# Requires: gem install httpclient require 'httpclient' client = HTTPClient.new default_header: { "Authorization" => "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd" } response = client.post("https://hi.vectorizer.ai/api/v1/vectorize", { "image" => File.open("example.jpeg", "rb"), # TODO: Replace with your image # TODO: Add more upload parameters here }) if response.status == 200 then # Write result to disk, TODO: or wherever you'd like File.open("result.svg", 'w') { |file| file.write(response.body) } else puts "Error: Code: " + response.status.to_s + ", Reason: " + response.reason end
$ curl https://hi.vectorizer.ai/api/v1/vectorize \ -u xyz123:[secret] \ -F 'image.url=https://example.com/example.jpeg' \ -o result.svg
// Requires: org.apache.httpcomponents.client5:httpclient5-fluent Request request = Request.post("https://hi.vectorizer.ai/api/v1/vectorize") .addHeader("Authorization", "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd") .body( MultipartEntityBuilder.create() .addTextBody("image.url", "https://example.com/example.jpeg") // TODO: Replace with your image URL // TODO: Add more upload parameters here .build() ); ClassicHttpResponse response = (ClassicHttpResponse) request.execute().returnResponse(); if (response.getCode() == 200) { // Write result to disk, TODO: or wherever you'd like try (FileOutputStream out = new FileOutputStream("result.svg")) { response.getEntity().writeTo(out); } } else { System.out.println("Request Failed: Status: " + response.getCode() + ", Reason: " + response.getReasonPhrase()); }
using (var client = new HttpClient()) using (var form = new MultipartFormDataContent()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "INSERT_API_KEY_HERE"); form.Add(new StringContent("https://example.com/example.jpeg"), "image.url"); // TODO: Replace with your image URL // TODO: Add more upload parameters here var response = client.PostAsync("https://hi.vectorizer.ai/api/v1/vectorize", form).Result; if (response.IsSuccessStatusCode) { // Write result to disk, TODO: or wherever you'd like FileStream outStream = new FileStream("result.svg", FileMode.Create, FileAccess.Write, FileShare.None); response.Content.CopyToAsync(outStream).ContinueWith((copyTask) => { outStream.Close(); }); } else { Console.WriteLine("Request Failed: Status: " + response.StatusCode + ", Reason: " + response.ReasonPhrase); } }
// Requires "request" to be installed (see https://www.npmjs.com/package/request) var request = require('request'); var fs = require('fs'); request.post({ url: 'https://hi.vectorizer.ai/api/v1/vectorize', formData: { 'image.url': 'https://example.com/example.jpeg', // TODO: Replace with your image // TODO: Add more upload options here }, auth: {user: 'xyz123', pass: '[secret]'}, followAllRedirects: true, encoding: null }, function(error, response, body) { if (error) { console.error('Request failed:', error); } else if (!response || response.statusCode != 200) { console.error('Error:', response && response.statusCode, body.toString('utf8')); } else { // Save result fs.writeFileSync("result.svg", body); } });
$ch = curl_init('https://hi.vectorizer.ai/api/v1/vectorize'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd')); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'image.url' => 'https://example.com/example.jpeg', // TODO: Add more upload options here )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch); if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) { // Save result file_put_contents("result.svg", $data); } else { echo "Error: " . $data; } curl_close($ch);
# Either use the sample code below, or this SDK: https://pypi.org/project/vectorizer-ai/ # Requires "requests" to be installed (see https://pypi.org/project/requests/) import requests response = requests.post( 'https://hi.vectorizer.ai/api/v1/vectorize', data={ 'image.url': 'https://example.com/example.jpeg', # TODO: Add more upload options here }, auth=('xyz123', '[secret]') ) if response.status_code == requests.codes.ok: # Save result with open('result.svg', 'wb') as out: out.write(response.content) else: print("Error:", response.status_code, response.text)
# Requires: gem install httpclient require 'httpclient' client = HTTPClient.new default_header: { "Authorization" => "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd" } response = client.post("https://hi.vectorizer.ai/api/v1/vectorize", { "image.url" => "https://example.com/example.jpeg", # TODO: Replace with your image URL # TODO: Add more upload parameters here }) if response.status == 200 then # Write result to disk, TODO: or wherever you'd like File.open("result.svg", 'w') { |file| file.write(response.body) } else puts "Error: Code: " + response.status.to_s + ", Reason: " + response.reason end
API के साथ एकीकृत करना और उसका परीक्षण करना मुफ़्त है, और इसके लिए किसी सदस्यता की आवश्यकता नहीं है।
बनाने के लिए बस mode=test
का इस्तेमाल करें। आप फ्रंट पेज़ पर इंटरैक्टिव वेब ऐप का इस्तेमाल करके परिणाम की गुणवत्ता का मूल्यांकन कर सकते हैं।
उत्पादन परिणामों के लिए सदस्यता की आवश्यकता होती है और प्रत्येक के लिए 1.00 credit की जरूरत होती है।
हम प्रीव्यू रिज़ल्ट भी दिखाते हैं जिन्हें आप खरीदने से पहले अपने अंतिम-उपयोगकर्ता को दिखा सकते हैं।
प्रीव्यूज़ PNG तस्वीरें होती हैं, जो आपके इनपुट से चार गुना बड़ी होती हैं, एक छुपे हुए वाटरमार्क के साथ आती हैं, और प्रत्येक की कीमत 0.20credit होती है।
प्रीव्यू परिणाम प्राप्त करने के लिए बस mode=preview
का इस्तेमाल करें।
कृपया सब्सक्रिप्शन प्लानों के लिए कीमत पेज को देखें।
API मानक HTTP मूलभूत पहुँच प्रमाणीकरण का इस्तेमाल करता है। API के लिए सभी अनुरोध HTTPS पर किए जाने चाहिए और इसमें उपयोगकर्ता के रूप में API Id और पासवर्ड के रूप में API सीक्रेट के साथ आपके API क्रेडेंशियल शामिल होने चाहिए।
अनुरोधों को सफलतापूर्वक करने के लिए आपकी http क्लायंट लाइब्रेरी को सर्वर नाम सूचना (SNI) का समर्थन करना होगा। यदि आप अजीब हैंडशेक एरर्स का सामना कर रहे हैं, तो इसकी सबसे अधिक संभावना है।
API का इस्तेमाल उदार छूट सहित और बिना किसी ऊपरी सीमा के साथ दर द्वारा सीमित है।
सामान्य अंत्य-उपयोगकर्ता-संचालित प्रचालन के दौरान आपके द्वारा दर सीमा का सामना करने की आशंका कम है क्योंकि तब इस्तेमाल कम होने लगता है और इस तरह प्रवाहित होता है कि इसे सेवा द्वारा गरिमामय तरीके से संभाल लिया जाता है।
फिर भी, बैच आधारित कामों के लिए हम अधिकतम 5 थ्रेड्स के साथ शुरुआत करने की सलाह देते हैं, फिर प्रत्येक 5 मिनट में 1 नया थ्रेड तब तक जोड़ते रहें, जब तक कि आप समरूपता के वांछित स्तर तक नहीं पहुंच जाते। यदि आपको 100 से अधिक समवर्ती थ्रेड्स की आवश्यकता हो, तो शुरू करने से पहले कृपया संपर्क करें।
यदि आप अत्यधिक अनुरोध प्रस्तुत करते हैं तो आपको 429 Too Many Requests
प्रत्युत्तर मिलने शुरू हो जाएंगे। जब भी ऐसा हो तो आपको रैखिक बैक ऑफ लागू करना चाहिए: पहली बार ऐसा प्रत्युत्तर मिलने पर, अगला अनुरोध प्रस्तुत करने तक 5 सेकंड इंतज़ार करें। लगातार दूसरे 429 प्रत्युत्तर पर, अगला अनुरोध प्रस्तुत करने तक 2*5 = 10 सेकंड इंतज़ार करें। तीसरे में 3*5 = 15 सेकंड इंतज़ार करें, इत्यादि।
सफल अनुरोध के बाद आप बैक ऑफ काउंटर रीसेट कर सकते हैं, और आपको बैक-ऑफ को प्रति-थ्रेड के आधार पर लागू करना चाहिए (अर्थात थ्रेड्स को एक दूसरे से स्वतंत्र रूप से काम करना चाहिए)।
POST
https://api.vectorizer.ai/api/v1/vectorize
इमेज वैक्टरीकृत करने के लिए, आप एक मानक HTTP POST फाइल अपलोड करते हैं। ध्यान रखें कि बाइनरी फाइलों को अपलोड करते समय सामग्री-प्रकार को multipart/form-data
में होना चाहिएmultipart/form-data
नीचे दी गई तालिका सभी API मापदंडों को एक कार्यशील अभी-आजमायें-फ़ॉर्म में प्रस्तुत करती है। प्रत्येक पैरामीटर का एक संक्षिप्त विवरण है, लेकिन विस्तृत आउटपुट विकल्प दस्तावेज़ीकरण को अवश्य देखें।
तारीख | बदलें |
---|---|
3 अक्तू॰ 2023 |
स्पष्ट किया जाता है कि processing.max_colors में अनुरोधित किये गये के मुकाबले output.gap_filler.enabled=true परिणाम में अधिक रंगों की ओर ले जाता है।
|
20 सित॰ 2023 |
जोड़ा गया है mode
|
1 अग॰ 2023 |
निम्नलिखित विकल्पों के साथ एक पूर्ण विशेषताओं वाला आउटपुट आकार का विकल्प समूह जोड़ा गया है: output.size.scale , output.size.width , output.size.height , output.size.unit , output.size.aspect_ratio , output.size.align_x , output.size.align_y , output.size.input_dpi , और output.size.output_dpi । एक विकल्प के साथ बिटमैप आउटपुट विकल्प समूह जोड़ा गया है: output.bitmap.anti_aliasing_mode ।
|
7 जून 2023 |
जोड़ा गया है processing.max_colors
|
31 मई 2023 | API मापदंडों का काफी अधिक विस्तार किया गया है। API के एंडपॉइंट को अपडेट किया गया है। |
10 मार्च 2023 | प्रारंभिक रिलीज़। |