ویب پر گرفت اور تبدیل کرنے کے اوزار

ویب سائٹ اسکرین شاٹس پر قبضہ کریں یا HTML کو امیجز میں تبدیل کریں

Node.js API

ویب سائٹ کے مندرجہ ذیل خصوصیات کا استعمال کرکے کامل امیج اسکرین شاٹس بنائیں GrabzIt's Node.js API. تاہم ، اس سے پہلے کہ آپ فون کریں ، یاد رکھیں url_to_image, html_to_image or file_to_image طریقوں save or save_to اسکرین شاٹ لینے کے ل method طریقہ کو بلایا جانا چاہئے۔

بنیادی اختیارات

ویب پیج یا اسکرین شاٹ لینے کے لئے صرف ایک پیرامیٹر کی ضرورت ہے HTML کو تبدیل کریں intOA تصویر جیسا کہ مندرجہ ذیل مثال میں دکھایا گیا ہے۔

client.url_to_image("https://www.tesla.com");
//Then call the save or save_to method
client.html_to_image("<html><body><h1>Hello World!</h1></body></html>");
//Then call the save or save_to method
client.file_to_image("example.html");
//Then call the save or save_to method

تصویری اسکرین شاٹ فارمیٹس

GrabzIt کا Node.js API JPG ، PNG ، WEBP ، BMP (8 بٹ ، 16 بٹ ، 24 بٹ یا 32 بٹ) اور TIFF سمیت متعدد فارمیٹس میں امیج اسکرین شاٹس لے سکتا ہے۔ تصویری اسکرین شاٹس کے لئے پہلے سے طے شدہ شکل JPG ہے۔ تاہم ، ان حالات میں جے پی جی امیج کا معیار اتنا اچھا نہیں ہوسکتا ہے کہ PNG فارمیٹ کو امیج اسکرین شاٹس کے ل for تجویز کیا جاتا ہے کیونکہ یہ معیار اور فائل کے سائز کے درمیان اچھا توازن فراہم کرتا ہے۔ ذیل کی مثال PNG فارمیٹ کا استعمال کرتے ہوئے لی گئی ایک امیج اسکرین شاٹ کو دکھاتی ہے۔

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"format":"png"};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.png", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"format":"png"};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.png", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"format":"png"};

client.file_to_image("example.html", options);
//Then call the save or save_to method
client.save_to("result.png", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

براؤزر کا سائز

براؤزر کا سائز براؤزر ونڈو کے سائز سے مراد ہے جو زیادہ تر معاملات میں اسکرین شاٹ کی گرفتاری کے وقت استعمال ہوگا جب کہ یہ طے کرنے کی ضرورت نہیں ہے کیونکہ تمام تر کاموں کے لئے پہلے سے طے شدہ براؤزر کا سائز کافی ہوگا۔ تاہم اگر آپ براؤزر کی چوڑائی اور اونچائی قائم کرنا چاہتے ہیں تو ایک مثال ذیل میں دکھائی گئی ہے۔

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"browserWidth":1366, "browserHeight":768};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"browserWidth":1366, "browserHeight":768};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"browserWidth":1366, "browserHeight":768};

client.file_to_image("example.html", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

تصویری سائز تبدیل کریں

کسی شبیہہ کے سائز کو تبدیل کرنا آسان ہے ، تصویر کو مسخ کیے بغیر کرنا کچھ مشکل ہے۔ پورے عمل کو آسان بنانے کے ل we ہم آپ کو مشورہ دیتے ہیں کہ آپ اسے استعمال کریں سادہ تصویری جہت کیلکولیٹر.

اگر آپ تصویری چوڑائی اور اونچائی کو براؤزر کی چوڑائی اور اونچائی سے بڑے سائز میں بڑھانا چاہتے ہیں ، جو 1366 بذریعہ 728 پکسلز ہے ، تو براؤزر کی چوڑائی اور اونچائی کو بھی میچ کرنے کیلئے بڑھانا ہوگا۔

کسٹم شناختی

آپ کو ایک کسٹم شناخت کنندہ پاس کرسکتے ہیں تصویر جیسا کہ ذیل میں دکھایا گیا ہے ، اس کی قیمت آپ کے GrabzIt Node.js ہینڈلر کو واپس کردی جاتی ہے۔ مثال کے طور پر یہ کسٹم شناخت کنندہ ایک ڈیٹا بیس شناخت کنندہ ہوسکتا ہے ، جس سے اسکرین شاٹ کو کسی خاص ڈیٹا بیس ریکارڈ کے ساتھ وابستہ کیا جاسکتا ہے۔

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.url_to_image("https://www.tesla.com", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.file_to_image("example.html", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});

مکمل لمبائی اسکرین شاٹ

GrabzIt آپ کو ایک پورے ویب پیج کی مکمل لمبائی کا اسکرین شاٹ لینے کی اجازت دیتا ہے اس کے ل you آپ کو ایک ایکس ایکس ایکس ایکس پاس کرنے کی ضرورت ہے browserHeight پراپرٹی اس بات کا یقین کرنے کے لئے کہ براؤزر کے سائز سے مماثلت مماثلت رکھتی ہو ، اس کو ایک -1 پاس سے گزریں height اور width خواص.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"browserHeight":-1,"width":-1, "height":-1};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"browserHeight":-1,"width":-1, "height":-1};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"browserHeight":-1,"width":-1, "height":-1};

client.file_to_image("example.html", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

آپ تھمب نیل بھی واپس کرسکتے ہیں جو فصل نہیں لگے ہیں ، لیکن ہوشیار رہیں کہ اس سے بڑی تصاویر تشکیل دے سکتی ہیں۔ ایسا کرنے کے ل a ایک -1 پاس کریں height اور / یا width خصوصیات جس طول و عرض کو -1 منظور کیا گیا ہے وہ فصل نہیں کی جائے گی۔

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"width":-1, "height":-1};

client.url_to_image("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"width":-1, "height":-1};

client.html_to_image("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"width":-1, "height":-1};

client.file_to_image("example.html", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
نوٹ کریں براؤزر کی پوری چوڑائی نہیں ہے!

ان خصوصی قدروں کو استعمال کرنے کا مطلب یہ ہے کہ آپ ایک اسکرین شاٹ تشکیل دے سکتے ہیں جو اگر آپ چاہیں تو پورے ویب پیج کا مکمل پیمانہ ورژن ہے۔

کسی صفحہ عنصر کا اسکرین شاٹ لیں

GrabzIt آپ کو HTML عنصر کا اسکرین شاٹ لینے کی اجازت دیتا ہے ، جیسے کہ div or span ٹیگ ، اور اس کے تمام مواد پر قبضہ. اس کے ل To ، HTML عنصر جس کی آپ اسکرین شاٹ لینا چاہتے ہیں اسے بطور درج ہونا ضروری ہے سی ایس ایس سلیکٹر.

...
<div id="features">
	<img src="http://www.example.com/boat.jpg"/><h3>New Boat Launched</h3>
</div>
...

ذیل کی مثال کے طور پر ہم id کو "خصوصیات" کے ساتھ منتخب کریں گے اور اسے 250 x 250px JPEG تصویر کے بطور برآمد کریں گے۔

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

// The 250 parameters indicates that image should be sized to 250 x 250 px
var options = {"width":250, "height":250, "format":"jpg","target":"#features"};

client.url_to_image("http://www.bbc.co.uk/news", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

اگلی مثال "خصوصیات" ڈیو کا دوسرا اسکرین شاٹ لیتا ہے لیکن اس بار جے پی ای جی کی ایک تصویر سامنے آتی ہے جو Div کا عین مطابق سائز ہے۔

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

// The minus ones indicates that image should not be cropped
var options = {"browserHeight":-1, "width":-1, "height":-1, "format":"jpg", "target":"#features"};

client.url_to_image("http://www.bbc.co.uk/news", options);
//Then call the save or save_to method
client.save_to("result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});