开发者

How to convert a web page into an image using MATLAB?

开发者 https://www.devze.com 2022-12-27 04:20 出处:网络
This task is very hard to finish in othe开发者_开发问答r programming languages, what about in MATLAB?I\'m not sure if Matlab is the best way to do this, but here\'s how:

This task is very hard to finish in othe开发者_开发问答r programming languages,

what about in MATLAB?


I'm not sure if Matlab is the best way to do this, but here's how:

  1. use Matlab's built-in web function to open your webpage in a Matlab browser
  2. Download and use the ScreenCapture utility from the Matlab File Exchange to save a screenshot to file

If you need finer-grained control, you can use Java's java.awt.Robot.createScreenCapture to take a screenshot that you can then save. This can be done from within Matlab (it is actually the basis of the ScreenCapture utility), or from standalone Java code.


you could install one of these firefox plugins (along with firefox), make a system call to firefox from your program with the appropriate arguments to firefox, and voila, you have a program that takes screenshots of a web page.


Not sure if you're looking for a pure MATLAB solution. But if you have Python handy, take a look at PyWebShot. Then, you can just call the Python script from MATLAB using the exclamation mark syntax, etc.


I have no idea how to do that in MATLAB (nor why would you want to do that in MATLAB, unless it's a part of something larger) ... but there is a specialized plugin for Firefox, for doing just that ... FireShot. Works nicely, no fussing about.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号