Josuke
Posts: 6
Joined: Wed Jul 24, 2019 4:41 pm

convertor from html to PNG in console #RaspberryPi

Wed Jul 24, 2019 4:57 pm

Hello all, I need converter from HTML page into PNG file (it also can be jpeg etc) what I can use thru console in my RaspberryPi
Not working ones converters
-webkit2png
- wkhtmltoimage
both show some kind of nonsens in console

.

klricks
Posts: 6586
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: convertor from html to PNG in console #RaspberryPi

Sat Jul 27, 2019 3:01 am

Josuke wrote:
Wed Jul 24, 2019 4:57 pm
Hello all, I need converter from HTML page into PNG file (it also can be jpeg etc) what I can use thru console in my RaspberryPi
Not working ones converters
-webkit2png
- wkhtmltoimage
both show some kind of nonsens in console

.
Pressing [Print Screen] key will create a png image of the desktop screen. (uses scrot)
Or use scrot from the command line or in a script.
From a script you could load the browser in full screen or kiosk mode then take a screen capture after a time delay etc.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
rpdom
Posts: 15177
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: convertor from html to PNG in console #RaspberryPi

Sat Jul 27, 2019 6:57 am

klricks wrote:
Sat Jul 27, 2019 3:01 am
Pressing [Print Screen] key will create a png image of the desktop screen. (uses scrot)
OP specified console, so I assume not running desktop.

There is an option in Firefox that may work.

Code: Select all

firefox --screenshot $URL
is supposed to save a screenshot of the $URL page in the current directory. I don't know if it works on a system without desktop.

Josuke
Posts: 6
Joined: Wed Jul 24, 2019 4:41 pm

Re: convertor from html to PNG in console #RaspberryPi

Wed Jul 31, 2019 9:04 pm

rpdom wrote:
Sat Jul 27, 2019 6:57 am
klricks wrote:
Sat Jul 27, 2019 3:01 am
Pressing [Print Screen] key will create a png image of the desktop screen. (uses scrot)
OP specified console, so I assume not running desktop.

There is an option in Firefox that may work.

Code: Select all

firefox --screenshot $URL
is supposed to save a screenshot of the $URL page in the current directory. I don't know if it works on a system without desktop.
If I have raspbian as OS is it work or not&

Andyroo
Posts: 4465
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: convertor from html to PNG in console #RaspberryPi

Wed Jul 31, 2019 9:58 pm

Josuke wrote:
Wed Jul 24, 2019 4:57 pm
Hello all, I need converter from HTML page into PNG file (it also can be jpeg etc) what I can use thru console in my RaspberryPi
Not working ones converters
-webkit2png
- wkhtmltoimage
both show some kind of nonsens in console

.
What do they show - it may be easier to fix these than find another solution...
Need Pi spray - these things are breeding in my house...

Andyroo
Posts: 4465
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: convertor from html to PNG in console #RaspberryPi

Sat Sep 07, 2019 1:00 pm

Need Pi spray - these things are breeding in my house...


Josuke
Posts: 6
Joined: Wed Jul 24, 2019 4:41 pm

Re: convertor from html to PNG in console #RaspberryPi

Sat Sep 07, 2019 5:36 pm

Andyroo wrote:
Wed Jul 31, 2019 9:58 pm
Josuke wrote:
Wed Jul 24, 2019 4:57 pm
Hello all, I need converter from HTML page into PNG file (it also can be jpeg etc) what I can use thru console in my RaspberryPi
Not working ones converters
-webkit2png
- wkhtmltoimage
both show some kind of nonsens in console

.
What do they show - it may be easier to fix these than find another solution...
webkit2png is not working because its for IOS LOL

wkhtmltoimage installed with wkhtmltopdf ) well to convert html site to pdf its working(command -> wkhtmltopdf http://google.com google.pdf) but then I am trying to convert html to image (command wkhtmltoimage http://google.com google.jpeg) this shows
"bash: /usr/local/bin/wkhtmltoimage: cannot execute binary file: Exec format error"

Andyroo
Posts: 4465
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: convertor from html to PNG in console #RaspberryPi

Sat Sep 07, 2019 5:59 pm

Josuke wrote:
Sat Sep 07, 2019 4:35 pm
Bad URL
Mods must have had a tidy - it was fine when posted :lol:

How did you install these - it reads like you have a total mix of x86, ARM and iOS install files?

What version of the operating system are you using?
Need Pi spray - these things are breeding in my house...

Josuke
Posts: 6
Joined: Wed Jul 24, 2019 4:41 pm

Re: convertor from html to PNG in console #RaspberryPi

Fri Sep 13, 2019 11:23 am

Well I found solution it is Cutycapt
OS ->Raspberry Pi newest(on ) 13/06/2018 version ( Raspbian v->July 2019)
Raspberry PI-> Raspberry Pi Model B V1.1
Installation guide :
1)
$ sudo apt-get update
$ sudo apt-get upgrade
2)
$ sudo apt-get install cutycapt
3)
????
4)
PROFIT!

How to use it:
CutyCapt support formats ->SVG, PDF, PS, PNG, JPEG, TIFF, GIF btw have support of javascript and you can convert HTML files(it can be file in your Pi) to image. More info-> $cutycapt --help

type this in console for test:
$ cutycapt --url=http://www.google.com --out=google.png
AWARE!
  • output image will be placed in working directory and THE MOST important CutyCapt by some mean "squeezes" output image
    better use like that (output image will be 1920x1080)
    $ cutycapt --url=http://www.google.com --out=google.png --min-width=1920 --min-height=1080
  • How to use CutyCapt on a headless server(no monitor connection to Raspberry Pi)
    *it fixes:
    • cannot connect to X server :0
    • cannot connect to X monitor
    1)Install Xvfb
    $sudo apt-get install xvfb
    2)After installing Xvfb change the command of cutycapt as:-
    $xvfb-run --server-args="-screen 0, 1280x1200x24" cutycapt --url=http://www.demo.com --out=demo.png
    --server-args and dimension are optional here.

    It will first launch the Xvfb server then use CutyCapt to screen capture of the webpage.
    So it may take longer. If you want to take multiple screenshots
    then you start can Xvfb server as a background daemon beforehand.

    Source ->https://www.oodlestechnologies.com/blog ... ss-server/
Source of CutyCapt ->http://xmodulo.com/convert-html-web-pag ... linux.html
Potential fix of libraries ->http://edwinhernandez.com/2013/05/26/in ... tu-12-0-4/
Last edited by Josuke on Fri Sep 20, 2019 7:02 am, edited 1 time in total.

Josuke
Posts: 6
Joined: Wed Jul 24, 2019 4:41 pm

Re: convertor from html to PNG in console #RaspberryPi

Fri Sep 13, 2019 11:24 am

Andyroo wrote:
Sat Sep 07, 2019 5:59 pm
Josuke wrote:
Sat Sep 07, 2019 4:35 pm
Bad URL
Mods must have had a tidy - it was fine when posted :lol:

How did you install these - it reads like you have a total mix of x86, ARM and iOS install files?

What version of the operating system are you using?
Found the answer

Return to “Graphics, sound and multimedia”