Skip to content

Commit 344605a

Browse files
authored
Merge pull request #124 from vgalin/develop
Develop
2 parents 8ec3d13 + 32c4c30 commit 344605a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020
|[PyPI Package](https://pypi.org/project/html2image/)|[GitHub Repository](https://github.com/vgalin/html2image)|
2121
|-|-|
2222

23-
**A lightweight Python package acting a wrapper around the headless mode of existing web browsers, allowing images generation from HTML/CSS strings, files and URLs.**
23+
**A lightweight Python package acting as wrapper around the headless mode of existing web browsers, allowing image generation from HTML/CSS strings, files and URLs.**
2424

2525
</div>
2626
&nbsp;
2727

28-
This package has been tested on Windows, Ubuntu (desktop and server) and MacOS. It is currently in a work in progress stage. If you encounter any problem or difficulties while using it, feel free to open an issue on the GitHub page of this project. Feedback is also welcome!
28+
This package has been tested on Windows, Ubuntu (desktop and server) and MacOS. If you encounter any problems or difficulties while using it, feel free to open an issue on the GitHub page of this project. Feedback is also welcome!
2929

3030

3131
## Principle
3232

3333

34-
Most web browsers have a Headless Mode, which is a way to run them without displaying any graphical interface. Headless mode is mainly used for automated testings but also comes in handy if you want to take screenshots of web pages that are exact replicas of what you would see on your screen if you were using the browser yourself.
34+
Most web browsers have a Headless Mode, which is a way to run them without displaying any graphical interface. Headless mode is mainly used for automated testing but also comes in handy if you want to take screenshots of web pages that are exact replicas of what you would see on your screen if you were using the browser yourself.
3535

36-
However, for the sake of taking screenshots, headless mode is not very convenient to use. HTML2Image aims to hide the inconveniences of the browsers' headless modes while adding useful features such as allowing to create an image from as little as a string.
36+
However, for the sake of taking screenshots, headless mode is not very convenient to use. HTML2Image aims to hide the inconveniences of the browsers' headless modes while adding useful features, such as allowing the creation of images from simple strings.
3737

3838
For more information about headless modes :
3939
- (Chrome) [https://developers.google.com/web/updates/2017/04/headless-chrome](https://developers.google.com/web/updates/2017/04/headless-chrome)
@@ -63,7 +63,7 @@ Multiple arguments can be passed to the constructor:
6363

6464
- `browser` : Browser that will be used, can be set to `'chrome'` (default) or `'edge'`.
6565
- `browser_executable` : The path or the command that can be used to find the executable of a specific browser.
66-
- `output_path` : Path to the folder to which taken screenshots will be outputed. Default is the current working directory of your python program.
66+
- `output_path` : Path to the folder to which taken screenshots will be outputted. Default is the current working directory of your python program.
6767
- `size` : 2-Tuple representing the size of the screenshots that will be taken. Default value is `(1920, 1080)`.
6868
- `temp_path` : Path that will be used to put together different resources when screenshotting strings of files. Default value is `%TEMP%/html2image` on Windows, and `/tmp/html2image` on Linux and MacOS.
6969
- `keep_temp_files` : Pass True to this argument to not automatically remove temporary files created in `temp_path`. Default is False.
@@ -80,7 +80,7 @@ hti.size = (500, 200)
8080

8181
### Then take a screenshot
8282

83-
The `screenshot` method is the basis of this package, most of the time, you won't need to use anything else. It can take screenshots of a lot of things :
83+
The `screenshot` method is the basis of this package. Most of the time, you won't need to use anything else. It can take screenshots of various things:
8484
- URLs via the `url` parameter;
8585
- HTML and CSS **files** via the `html_file` and `css_file` parameters;
8686
- HTML and CSS **strings** via the `html_str` and `css_str` parameters;
@@ -90,7 +90,7 @@ And you can also (optional):
9090
- Change the size of the screenshots using the `size` parameter;
9191
- Save the screenshots as a specific name using the `save_as` parameter.
9292

93-
*N.B. : The `screenshot` method returns a **list** containing the path(s) of the screenshot(s) it took.*
93+
*N.B.: The `screenshot` method returns a **list** containing the path(s) of the screenshot(s) it took.*
9494

9595
### A few examples
9696

@@ -168,7 +168,7 @@ hti.screenshot(html_str=['A', 'B', 'C'], save_as=['A.png', 'B.png', 'C.png'])
168168
```python
169169
# take four screenshots with a resolution of 100*50
170170
hti.screenshot(
171-
html_str=['A', 'B', 'C', 'D']
171+
html_str=['A', 'B', 'C', 'D'],
172172
size=(100, 50)
173173
)
174174
```
@@ -277,9 +277,9 @@ For ease of use, some flags are set by default. However default flags are not us
277277
```
278278

279279
## Using the CLI
280-
HTML2image comes with a Command Line Interface which you can use to generate screenshots from files and urls on the go.
280+
HTML2image comes with a Command Line Interface which you can use to generate screenshots from files and URLs on the go.
281281

282-
The CLI is a work in progress and may be subject to changes.
282+
The CLI is a work in progress and may undergo changes.
283283
You can call it by typing `hti` or `html2image` into a terminal.
284284

285285

@@ -327,19 +327,19 @@ python -m pytest
327327
## FAQ
328328

329329
- Can I automatically take a full page screenshot?
330-
**Sadly no**, it is not easily possible. Html2Image relies on the headless mode of Chrome/Chromium browsers to take screenshots and there is no way to "ask" for a full page screenshot at the moment. If you know a way to take one (by estimating the page size for example) I would be happy to see it, so please open an issue or a discussion!
330+
**Sadly no**, it is not easily possible. Html2Image relies on the headless mode of Chrome/Chromium browsers to take screenshots and there is no way to "ask" for a full page screenshot at the moment. If you know a way (by estimating the page size for example), please open an issue or a discussion!
331331

332332
- Can I add delay before taking a screenshot?
333333
**Yes** you can, please take a look at the `Change browser flags` section of the readme.
334334

335-
- Can I speed up the screenshot taking process?
336-
**Yes**, when you are taking a lot of screenshots, you can achieve better "performances" using Parallel Processing or Multiprocessing methods. You can find an [example of it here](https://github.com/vgalin/html2image/issues/28#issuecomment-862608053).
335+
- Can I speed up the screenshot-taking process?
336+
**Yes**, when you are taking a lot of screenshots, you can achieve better performance using Parallel Processing or Multiprocessing methods. You can find an [example of it here](https://github.com/vgalin/html2image/issues/28#issuecomment-862608053).
337337

338338
- Can I make a cookie modal disappear?
339-
**Yes and no**. **No** because there is no options to do it magically and [extensions are not supported in headless Chrome](https://bugs.chromium.org/p/chromium/issues/detail?id=706008#c5) (The [`I don't care about cookies`](https://www.i-dont-care-about-cookies.eu/) extension would have been useful in this case). **Yes** because you can make any element of a page disappear by retrieving its source code, modifying it as you wish, and finally screenshotting the modified source code.
339+
**Yes and no**. **No**, because there is no options to do it magically and [extensions are not supported in headless Chrome](https://bugs.chromium.org/p/chromium/issues/detail?id=706008#c5) (The [`I don't care about cookies`](https://www.i-dont-care-about-cookies.eu/) extension would have been useful in this case). **Yes**, because you can make any element of a page disappear by retrieving its source code, modifying it as you wish, and finally screenshotting the modified source code.
340340
## TODO List
341341
- A nice CLI (currently in a WIP state).
342-
- Support of other browsers (such as Firefox when their screenshot feature will work).
342+
- Support for other browsers, such as Firefox, once their screenshot feature becomes operational.
343343
- PDF generation?
344344
- Contributing, issue templates, pull request template, code of conduct.
345345

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "html2image"
3-
version = "2.0.4.1"
3+
version = "2.0.4.2"
44
description = "Package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files."
55
authors = ["vgalin"]
66
license = "MIT"

0 commit comments

Comments
 (0)