ওয়েব ক্যাপচার এবং রূপান্তর করার সরঞ্জামসমূহ

ওয়েবসাইট স্ক্রিনশটগুলি ক্যাপচার করুন বা চিত্রগুলিতে এইচটিএমএল রূপান্তর করুন

নোড.জেএসপিআইপি

নিম্নলিখিত বৈশিষ্ট্যগুলি ব্যবহার করে ওয়েবসাইটগুলির নিখুঁত চিত্রের স্ক্রিনশট তৈরি করুন গ্র্যাজআইটি'র নোড.জেএসআইপিআই। তবে আপনি শুরু করার আগে মনে রাখবেন যে ফোন করার পরে url_to_image, html_to_image or file_to_image পদ্ধতিগুলি save or save_to স্ক্রিনশট নেওয়ার জন্য পদ্ধতিটি কল করতে হবে।

বেসিক বিকল্পসমূহ

ওয়েব পৃষ্ঠার স্ক্রিনশট নেওয়ার জন্য কেবল একটি প্যারামিটার প্রয়োজন এইচটিএমএল রূপান্তর intওএ ইমেজ যেমন নিম্নলিখিত উদাহরণে দেখানো হয়েছে।

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

চিত্র স্ক্রিনশট ফর্ম্যাট

জিআরজিআইটির নোড.জেএস এপিআই জেপিজি, পিএনজি, ওয়েবেপি, বিএমপি (এক্সএনএমএক্স বিট, এক্সএনএমএক্স বিট, এক্সএনএমএক্স বিট বা এক্সএনএমএক্স বিট) এবং টিআইএফএফ সহ একাধিক ফর্ম্যাটে চিত্রের স্ক্রিনশট নিতে পারে। চিত্রের স্ক্রিনশটগুলির জন্য ডিফল্ট ফর্ম্যাটটি হল জেপিজি। তবে এই পরিস্থিতিতে কিছু অ্যাপ্লিকেশনের জন্য কোনও জেপিজি চিত্রের মান যথেষ্ট ভাল নাও হতে পারে পিএনজি ফর্ম্যাটটি চিত্রের স্ক্রিনশটগুলির জন্য প্রস্তাবিত কারণ এটি গুণমান এবং ফাইলের আকারের মধ্যে একটি ভাল ভারসাম্য দেয়। নীচের উদাহরণে পিএনজি ফর্ম্যাট ব্যবহার করে একটি চিত্রের স্ক্রিনশট নেওয়া হচ্ছে তা দেখায়।

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;
    }
});

ব্রাউজারের আকার

ব্রাউজারের আকারটি ব্রাউজার উইন্ডোর আকারকে বোঝায় যা বেশিরভাগ ক্ষেত্রে স্ক্রীনশট ক্যাপচার করার সময় ব্যবহৃত হবে কারণ এটি ডিফল্ট ব্রাউজারের আকারটি সমস্ত কাজের জন্য যথেষ্ট হবে set তবে আপনি ব্রাউজারের প্রস্থ এবং উচ্চতা নির্ধারণ করতে চাইলে নীচে একটি উদাহরণ দেখানো হয়েছে।

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;
    }
});

চিত্রের আকার পরিবর্তন করুন

কোনও চিত্রের আকার পরিবর্তন করা সহজ, চিত্রটি বিকৃতি না করে এটি করা কিছুটা শক্ত। পুরো প্রক্রিয়াটিকে আরও সহজ করার জন্য আমরা আপনাকে এটি ব্যবহারের পরামর্শ দিই সাধারণ চিত্র মাত্রা ক্যালকুলেটর.

আপনি যদি ব্রাউজারের প্রস্থ এবং উচ্চতার চেয়ে বড় আকারে চিত্রের প্রস্থ এবং উচ্চতা বৃদ্ধি করতে চান, যা ডিফল্টরূপে 1366 পিক্সেল দ্বারা 728 হয় তবে ব্রাউজারের প্রস্থ এবং উচ্চতাও মিলে যেতে হবে।

কাস্টম আইডেন্টিফায়ার

আপনি একটি কাস্টম সনাক্তকারী পাস করতে পারেন ভাবমূর্তি পদ্ধতিগুলি নীচে দেখানো হয়েছে, এই মানটি আপনার গ্র্যাবজিট নোড.জেএস হ্যান্ডলারের কাছে ফিরে আসে। উদাহরণস্বরূপ, এই কাস্টম শনাক্তকারী কোনও ডাটাবেস শনাক্তকারী হতে পারে, একটি স্ক্রিনশটকে একটি নির্দিষ্ট ডাটাবেস রেকর্ডের সাথে যুক্ত করার অনুমতি দেয়।

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 আপনাকে একটি সম্পূর্ণ ওয়েব পৃষ্ঠার পূর্ণ দৈর্ঘ্যের স্ক্রিনশট নেওয়ার অনুমতি দেয় এটি করতে আপনাকে একটি -1 পাস করতে হবে 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;
    }
});

আপনি কাটা না হওয়া থাম্বনেইলগুলিও ফিরে আসতে পারেন তবে সাবধান থাকুন এটি বড় চিত্র তৈরি করতে পারে। এটি পাস করার জন্য একটি -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 আপনাকে এইচটিএমএল উপাদানগুলির স্ক্রিনশট নেওয়ার অনুমতি দেয় a div or span ট্যাগ করুন এবং এর সমস্ত সামগ্রী ক্যাপচার করুন। এইচটিএমএল উপাদানটি করতে আপনি স্ক্রিনশট করতে চান তা অবশ্যই হিসাবে নির্দিষ্ট করা উচিত সিএসএস নির্বাচক.

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

নীচের উদাহরণের জন্য আমরা আইডি "বৈশিষ্ট্যগুলি" দিয়ে ডিভিটি নির্বাচন করব এবং এটিকে 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;
    }
});

পরবর্তী উদাহরণটি "বৈশিষ্ট্যগুলি" বিভাগের অন্য একটি স্ক্রিনশট গ্রহণ করে তবে এবার একটি জেপিইজি চিত্র আউটপুট করে যা ডিভের সঠিক আকার।

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;
    }
});