- PhantomJS Tutorial
- PhantomJS - Home
- PhantomJS - Overview
- PhantomJS - Environment Setup
- PhantomJS - Object
- PhantomJS - Methods
- WebPage Module
- PhantomJS - Properties
- PhantomJS - Methods
- PhantomJS - Events/Callbacks
- PhantomJS - Child Process Module
- File System Module
- PhantomJS - Properties
- PhantomJS - Methods
- System Module
- PhantomJS - Properties
- Web Server Module
- PhantomJS - Properties
- PhantomJS - Methods
- Miscellaneous
- Command Line Interface
- PhantomJS - Screen Capture
- PhantomJS - Page Automation
- PhantomJS - Network Monitoring
- PhantomJS - Testing
- PhantomJS - REPL
- PhantomJS - Examples
- PhantomJS Useful Resources
- PhantomJS - Quick Guide
- PhantomJS - Useful Resources
- PhantomJS - Discussion
PhantomJS - renderBase64()
This method takes the screen capture and gives the image as a string in base46. The renderbase64 method supports formats like PNG, JPEG and JPG. It does not support GIF as of now. You can use the clipRect property to define the portion for image capture.
Syntax
Its syntax is as follows −
wpage.renderBase64('PNG');
Example
var wpage = require('webpage').create(); wpage.open('http://localhost/taks/wopen2.html', function (status) { var base64 = wpage.renderBase64('PNG'); console.log(base64); phantom.exit(); });
The above program generates the following output.
iVBORw0KGgoAAAANSUhEUgAAAZAAAAE3CAYAAACEpheaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAEl E QVR4nO3dv3OjSL8u8Ee33mA3uuXszGZnSnLd8jo6b4b+AmkS38R1TjQZCqXEmave3SpnTiC0am8w6UR O
phantomjs_webpage_module_methods.htm
Advertisements