foxriver76 / ioBroker.puppeteer

Adapter to control a headless browser to take screenshots of web pages.
MIT License
1 stars 2 forks source link

Option für "--force-device-scale-factor=" hinzufügen #16

Closed BernhardLinz closed 3 months ago

BernhardLinz commented 3 months ago

Bei Screenshots ist gerade Text / Buchstaben "verwaschen" / hat einen "blur". Eine Lösung bei Puppeteer dagegen ist den Scale-Faktor zu erhöhen. Dazu muss man Chrome mit der Option

--force-device-scale-factor=4

aufrufen - die 4 steht für 4-fache Auflösung. Dementsprechend würde ein 200x100 Pixel großer Screenshot dann 800x400 groß, dafür in in guter Qualität und ohne Blur

Es wäre schön wenn das Konfigurierbar wäre, ggf. eine Option das man allgemein Parameter an den Chrome-Browser durchreichen könnte beim SendTo Befehl.


in screenshots, text/letters are “washed out”/have a “blur”. A solution for Puppeteer, however, is to increase the scale factor. To do this you have to use Chrome with the option

--force-device-scale-factor=4

It would be nice if this were configurable, perhaps an option so that you could pass general parameters to the Chrome browser with the SendTo command.

foxriver76 commented 3 months ago

I think this should already work and may just need a bit better documentation from my side. Can you try if it works to send the following with the message e.g.

      viewportOptions: {
        width: 800,
        height: 600,
        deviceScaleFactor: 4,
      },

See https://github.com/foxriver76/ioBroker.puppeteer?tab=readme-ov-file#messages for the extended example.

You should be able to send everything specified here in the viewportOptions, hence width and height are mandatory rest is optional.

BernhardLinz commented 3 months ago

Yes, it works! A hint in the documentation would be usefull ;-)