If you want to set bit depth and convert HTML to PNG, the VeryPDF product HTML Converter Command Line is one of your best solutions. HTML Converter Command Line is capable of converting HTML to PNG, and it is also able to convert HTML to PDF, HTML to JP2, and HTML to other image files like TIF, JPG, JPEG, and GIF. Moreover, it supports batch conversion, so you can use it to covert one HTML file to PNG file, or HTML files to PNG files in batch.
The Portable Network Graphics (PNG) format was designed to replace the older and simpler GIF format and, to some extent, the much more complex TIFF format. For the Web, PNG compresses better than GIF in almost every case. PNG was and is intended to be a single-image format only, while MNGs and PNGs have different file extensions and different purposes. For image editing, PNG provides a useful format for the storage of intermediate stages of editing. PNG supports up to 48-bit, while GIF can only support up to 8-bit.
This article will focus on how to set bit depth when batch convert HTML to PNG via a command line.
The command you are going to employ is -bitcount <int>, which permits three parameter values: 1, 8, and 24. Three step are only required to set bit depth and batch convert HTML to PNG.
1. Run the command prompt window
The way to run the command prompt window is easy. You can take four steps to run the command prompt window:
Click “Start”; > Click “Run” to open the “Run” dialog box; > In the “Run” dialog box, enter “cmd”; > Then click “OK”.
2. Enter a command line
Generally speaking, if you want to convert HTML to PNG, and set color depth via a command line, this command line should consist of four factors:
htmltools -bitcount <int> <HTML file> <PNG file>
- Factor 1: htmltools ---- the executable file
- Factor 2: -bitcount <int> ---- the command which can be used to set color depth. The angle brackets are used to mark the essential content. int means integer.
- Factor 3: <HTML file> ---- the input HTML file(s)
- Factor 4: <PNG file> ---- the output PNG file(s)
Since you’ve already know what should be included in a command line, you can enter the command line in the command prompt window. But you should also notice that the whole directories rather than only the names of the files should appear in the command line. For instance
D:\htmltools\htmltools.exe -bitcount 8 D:\in\*.html D:\out\*.png
- D:\htmltools\htmltools.exe is the directory of the executable file htmltools.exe. But it is not the name but the direcory of the file that appears in the command prompt window. In this example, this means the executable file has been placed in the folder htmltools on disc D. The directory can be substituted.
- -bitcount 8 is the command specifying 8-bit as the bit depth for the output PNG file. The number can be replaced by 24 or 1.
- D:\in\*.html indicates that all the HTML files in the folder in on disk D are the input files.
- D:\out\*.png indicates that all the original files should be converted from HTML to PNG format in the folder out on disk D.
3. Press “Enter”
Click the single key “Enter” one the keyboard, you can control the VeryPDF HTML Converter Command Line to convert HTML to PNG files in the color depth of 8-bit right away and quickly get the PNG files converted from HTML files.
If you are interested in other articles, you can also read the related articles at the knowledge base of VeryPDF.