Resizing an Xvfb display - x11

Simple Question: Is there a way to resize a Xvfb display?
I tried with RandR but it seems that the RandR extension is not supported by Xvfb. Are there other ways to resize the screen?
Thanks for your help!

You can use the server-args command line argument to specify a custom resolution for the virtual frame buffer being created, but this does not change the resolution of an existing virtual frame buffer:
xvfb-run --server-args="-screen 0, 1024x768x24" ...

Most distributions now ship a version of Xvfb with randr support.
The code was committed in late 2015 vfb: add randr support (v2).
To resize you will first need to define a new mode (you can use tools like gtf to get the modeline definition values), add it to the virtual output, and then you can switch to it.
ie for 1280x1024:
xrandr --newmode "1280x1024" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode screen 1280x1024
xrandr -s 1280x1024

Related

How can I convert a PDF to image with no font losses?

I have read tons of stackoverflow questions about problems with fonts when converting (with ghostscript) from PDF to image.
Because you don't have the fonts embedded, the ghostscript tries to find alternatives in your system and render the better possible.
But I can not understand why my MacOSX Preview is rendering perfect a PDF and ghostscript can't.
gs -sFONTPATH=/Library/Fonts -sDEVICE=pngalpha -o file-%03d.png -r144 my.pdf
I'm even telling gs where the fonts are.
This is the output.
$ pdffonts cv18.pdf
Fontconfig warning: "/usr/local/etc/fonts/fonts.conf", line 86: unknown element "blank"
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
CenturyGothic,Bold TrueType WinAnsi no no no 13 0
CenturyGothic TrueType WinAnsi no no no 14 0
CourierNew TrueType WinAnsi no no no 15 0
Arial TrueType WinAnsi no no no 16 0
AYTOPC+Wingdings TrueType WinAnsi yes yes no 17 0
TimesNewRoman TrueType WinAnsi no no no 18 0
CenturyGothic,Italic TrueType WinAnsi no no no 24 0
$ gs -sDEVICE=pngalpha -o file-%03d.png -r300 cv18.pdf
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Querying operating system for font files...
Substituting font NewCenturySchlbk-Bold for CenturyGothic,Bold.
Loading C059-Bold font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/C059-Bold... 4357236 2918185 2219472 869812 4 done.
Substituting font NewCenturySchlbk-Roman for CenturyGothic.
Loading C059-Roman font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/C059-Roman... 4504148 3145674 2313416 951449 4 done.
Substituting font Courier for CourierNew.
Loading NimbusMonoPS-Regular font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/NimbusMonoPS-Regular... 4731860 3382093 2548760 1140366 4 done.
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Didn't find this font on the system!
Substituting font Helvetica for ArialMT.
Loading NimbusSans-Regular font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/NimbusSans-Regular... 4939372 3576328 2589160 1183936 4 done.
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/TimesNewRomanPSMT.
Can't find (or can't open) font file TimesNewRomanPSMT.
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/TimesNewRomanPSMT.
Can't find (or can't open) font file TimesNewRomanPSMT.
Didn't find this font on the system!
Substituting font Times-Roman for TimesNewRomanPSMT.
Loading NimbusRoman-Regular font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/NimbusRoman-Regular... 5196116 3849418 3003064 1540393 4 done.
Page 2
Substituting font NewCenturySchlbk-Roman for CenturyGothic.
Substituting font NewCenturySchlbk-Bold for CenturyGothic,Bold.
Substituting font NewCenturySchlbk-Italic for CenturyGothic,Italic.
Loading C059-Italic font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/C059-Italic... 5504628 4138508 2467960 1088660 4 done.
The question is: why MacOSX Preview is not having this problems? Where does it take the fonts from, to render perfectly ?
I would need to see your PDF file to be able to comment, but where you say "I'm even telling gs where the fonts are", I'm afraid that does not appear to be correct.
The Ghostscript back channel says:
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/ArialMT.
So either the file does not exist, or Ghostscript can't open it or just possibly its corrupted in some way.
Is fontconfig the only thing you are using to 'tell gs where the fonts are' ? Because if so, you aren't really telling Ghostscript anything. Note also the fontconfig warning, I'm not an expert with font config, but I suspect you may want to sort that out too.
Ghostscript may, or may not, use fontconfig, depending how it was built, which obviously I don't know. If you were to actually tell Ghostscript about the fonts (instead of fontconfig) then it might work better. You would need to edit/create a fontmap.GS file and tell Ghostscript where to find it, using the -I (Include) switch.
You can find an example fontmap.GS in /ghostscript/Resource/Init
In order to help more I'd need to knwo the exact path where the font file is located, the method you are using to tell Ghostscript where the font file is located, and the exact configuration of the fontmap.GS (or whatever means you are using). The PDF file and font file would also be helpful, in case the font file is corrupted in some way. I;d also be curious about the format of the ArialMT and C059-Roman fonts. PostScript or TrueType fonts ?

Initial Ubuntu guest screen resolution on VMWare

Windows 7 (host) with VMWare Workstation 11.
Kubuntu 15.04 as Guest.
Problem:
After system startup, in example, on login screen - screen size/resolution is 800x600. Ba, even earlier - during startup when console is active. Making window fullscreen isn't helping, as console output limits itself to small window in the middle.
Setting VMWare window into fullscreen helps a little - screen gets bigger (size of host 1920x1080) - guest Kubuntu applications windows are taking whole screen area. But, for example, desktop wallpaper acts still as if 800x600 was in effect. And inside System settings -> display Virtual screen stays at 800x600, nevertheless Resolution list is long. Unfortunately - 1920x1080 isn't there.
This what xrandr shows:
Screen 0: minimum 1 x 1, current 1920 x 1080, maximum 8192 x 8192
Virtual1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920x1080 60.0*+
2560x1600 60.0
1920x1440 60.0
1856x1392 60.0
1792x1344 60.0
1920x1200 59.9
1600x1200 60.0
1680x1050 60.0
1400x1050 60.0
1280x1024 60.0
1440x900 59.9
1280x960 60.0
1360x768 60.0
1280x800 59.8
1152x864 75.0
1280x768 59.9
1024x768 60.0
800x600 60.3
640x480 59.9
From this it seems that proper resolution is set properly.
Now, some magic. I logout from Kubuntu. Login screen is already taking whole 1920x1080 screen area. Settings -> Display shows Virtual screen as 1920x1080, xrandr shows the same set of resolutions.
VMWare Tools were installed - at least to the point that I have bidirectional access to shared folders.
What to do to have proper screen resolution right from the beginning? Yea, I know that I can freeze whole session and resume it whenever I need it.
My configuration is host : windows 7 and vmware guest : ubuntu 14.04.
For long time I've seen if I update the vmplayer or some software in vmplayer that screws my display and then in full screen it can no longer capture host display.So today I just followed the instruction provided in this link and fixed it without installing any additional software.I hope it helps other.
At first run :
$ xrandr -q
tanay#ubuntu:~$ xrandr -q Screen 0: minimum 1 x 1, current 1904 x 1070, maximum 8192 x 8192 Virtual1 connected primary 1904x1070+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 800x600
60.0 + 60.3 2560x1600 60.0 1920x1440 60.0 1856x1392 60.0 1792x1344 60.0 1920x1200 59.9 1600x1200 60.0 1680x1050 60.0 1400x1050 60.0 1280x1024 60.0 1440x900 59.9 1280x960 60.0 1360x768 60.0 1280x800 59.8 1152x864 75.0 1280x768 59.9 1024x768 60.0 640x480 59.9 1904x1070_75.00 74.9* Virtual2 disconnected (normal left inverted right x axis y axis) Virtual3 disconnected (normal left inverted right x axis y axis) Virtual4 disconnected (normal left inverted right x axis y axis) Virtual5 disconnected (normal left inverted right x axis y axis) Virtual6 disconnected (normal left inverted right x axis y axis) Virtual7 disconnected (normal left inverted right x axis y axis) Virtual8 disconnected (normal left inverted right x axis y axis)
Then you can see which output is connected,here Virtual1 is connected.
Then guess a good resolution for your screen.For me I guessed following configuration.
Eg:cvt <horizontal length> <vertical length> <refresh rate>
$ cvt 1900 1070 75
The output is
# 1904x1070 74.87 Hz (CVT) hsync: 83.85 kHz; pclk: 216.00 MHz Modeline "1904x1070_75.00" 216.00 1904 2040 2240 2576 1070 1073 1083 1120
-hsync +vsync
Then you need to copy the text after "Modelline" and paste that in following command after "newmode" like the example below
$ xrandr --newmode "1904x1070_75.00" 216.00 1904 2040 2240 2576 1070 1073 1083 1120 -hsync +vsync
Then take the screen resolution details from the quote and use it in next command.For me the command is
$ xrandr --addmode Virtual1 1904x1070_75.00
The next command to set it in ubuntu for me is
$ xrandr --output Virtual1 --mode 1904x1070_75.00
If the last command doesn't work for you,you can go back to ubuntu display gui setting and can chose the display you have added just now.For me the option was 1904 x 1070 (16:9)
However if you are fine with this experiment and have found the desired screen resolution and to make that permanent,write the all the last 3 commands starting from xrandr --newmode command in your .xprofile file using following command and then save,exit and restart your ubuntu vm and you will get your desired resolution permanently.
$ gedit ~/.xprofile
Here is what worked for me-
$ xrandr
out-put-
Screen 0: minimum 8 x 8, current 1024 x 768, maximum 32767 x 32767
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
1024x768 75.08*+ 60.00
800x600 60.32 56.25
848x480 60.00
640x480 59.94
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
1920x1080_60.00 (0x113) 173.000MHz -HSync +VSync
h: width 1920 start 2048 end 2248 total 2576 skew 0 clock 67.16KHz
v: height 1080 start 1083 end 1088 total 1120 clock 59.96Hz
Note:- found the connected on, for my case VGA1 connected primary
1024x768+0+0 all others are not connected.
$ cvt 1920 1080
$ sudo xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
Note:- based on connection we have to use on as-
4. sudo xrandr --addmode VGA1 "1920x1080_60.00"
It worked for me, as suggested here, another source presented here.

Mac Software to create different versions of an image

I'm looking for a software for mac that I can from one picture generate several versions with predefined sizes:
max with 300px
max width 600px
max width 1200px
Do you know a sw that can do this ?
Thanks
I think you can use OSX's built-in sips.
Start with a 2048x1536 image, copy it and resize copy to 300px wide
cp input.png 300.png
sips --resampleWidth 300 300.png # ==> 300x225 image
copy and resize the copy to 600ox
cp input.png 600.png
sips --resampleWidth 600 600.png # ==> 600x450 image
copy and resize to 1200px
cp input.png 1200.png
sips --resampleWidth 1200 1200.png # ==> 1200x900 image

Wrong coloring w/ Powerline in Terminal.app

I setup tmux powerline, and installed all the corresponding fonts. The problem I am running into now is colors not appearing the same when acting as a background in the hardline.
I made sure to set tmux to use 256 color mode
tmux.conf: http://hastebin.com/durehunuge.conf
Any ideas on how to get the colors to match?
Sadly the only way that I was able to fix this was by switching to iTerm2.
I assume you have trouble with the "arrow" symbols?
If so then you can easily fix that by using the correct symbol.
In your theme file you have some lines that look like that:
if patched_font_in_use; then
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="<U+2B82>"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="<U+2B83>"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="<U+2B80>"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="<U+2B81>"
else
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="◀"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="❮"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="▶"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="❯"
fi
Those are used in your segments, eg:
"weather 89 211" \
"date 235 136" \
"time 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" \
which would render on my machine as:
⮂ ☼ -1°C ⮂ 02.03.2013 ⮃ 10:02
As you can see the time arrow is thin without background.

Changing monitor brightness programatically in Ubuntu 11.10

I'm using Dell inspiron 1564 laptop with Ubuntu 11.10. Here I can change my monior brightness simply via fn+F4/5. But I need a low brightness even lower than the min limit of fn+F4. How can I do it programatically or which shell command to use for that?
I'm not sure that it's possible to go lower than what the laptop controls get you, but you can programatically change brightness by echoing a value to /sys/class/backlight/<something>/brightness. On my netbook the 'something' is acpi_video0.
$ cat /sys/class/backlight/acpi_video0/brightness
10
$ sudo sh -c 'echo 0 > /sys/class/backlight/acpi_video0/brightness'
$ cat /sys/class/backlight/acpi_video0/brightness
0
Edit: There's also xbacklight, which uses XRandr.
According to this site, you should be able to alter the brightness by modifying the /proc/acpi/video/VGA/LCD/brightness file.
The valid brightness levels appear to be:
levels: 12 25 37 50 62 75 87 100
So modifying that file accordingly should do what you need.
you can change it by following command sudo setpci -s 00:02.0 f4.b=00, here you can enter value from 00 to ff in hexadecimal, [00 = bright and ff = dull]
for more details go through the following link : http://daksh21ubuntu.blogspot.in/2011/12/how-to-increasedecrease-brightness-on.html

Resources