⬆️ ⬇️

Automating screening, do it yourself

In this set of letters, I will tell you about creating a screening service on my remote Linux server.



Interested in this question 6 months ago.

The first and most obvious solution lay on the surface: Some sort of X-based display virtualizer ( xvfb ), some renderer with an un-killed API / CLI, image-processing utilities (imageMagic), and some kind of brain.

So we have: Debian4 (later 5) on a remote virtual machine (VDS) virtualized on OpenVZ; xvfb; opera and php programming language set.

The xvfb installation is performed by standard package management tools, this software is in the repositories of almost all systems.

The only thing that, when running xvfb, can swear on the lack of packages. For example on xfonts-base.

It is solved simply, apt-cache search font | grep base and installation according to the package.

Swearing on other packs of fonts is eliminated similarly.

Opera staged with office. site for example from the deb-package. To remove all warnings, rule ~ / .opera / opera6.ini

[Extensions]

Plugin Failed Warning=0

Ask Flash Download=0

Plugins=0

...

[State]

Accept License=1

Reading Plugins=0

Run=1

...




Run xvfb and opera.



Xvfb :2 -screen 0 1280x1024x24

export DISPLAY=:2.0

/usr/bin/opera -nomail -nosession -disableinputmethods -geometry 1280x1024 -fullscreen "http://habrahabr.ru"


Excellent, the opera has rendered a picture, now you can save it, wait for 7 seconds, and prune the fields

xwd -root -display :2.0| xwdtopnm | pnmtojpeg -quality=90 -optimize > /home/web/jj/img/temp.jpg

xwd -root -silent | xwdtopnm | pamcut -left=5 -right=1260 -top=83 -bottom=1023 | pnmtojpeg -quality=85 -optimize > /home/web/jj/img/habr.jpg


Now the competent brain will program it and will use this blessing of civilization.

Result

That's all.

A little bit of PR:

By the way, I take VDS from vdsplanet , where firstvds escaped from the terrible quality.


')

Source: https://habr.com/ru/post/62261/



All Articles