10

I have connected to my raspberry via ssh from another pc. I would like to show an image that is on my raspberry to the screen of my PC. I tried to follow the answer of this question by astrogeek.

Suppose my raspberry user is pi and the user pc is pc.

I executed on my pc the command

xhost +pi@<rasp_ip>

and on the terminal connected via ssh to the raspberry

DISPLAY=pc@<pc_ip>:0

but when I try to open the *jpg image with fbi and other tools but nothing.

Does anyone know how to do that without copying the image locally?

Will the same method work using the pi-camera in real-time with the command raspistill -t 3000 for example?

EDIT: My PC OS is Ubuntu.

3
  • Is this a Windows PC? If that's the case, X forwarding won't work, because your Windows PC doesn't run the X display server.
    – Aurora0001
    Commented Jan 17, 2018 at 16:19
  • 2
    No it is Ubuntu. I will specify it in the question.Thanks Commented Jan 17, 2018 at 16:24
  • For raspicam you might want to install/enable UV4L instead (this provides an HTTP based streaming video server; you can also take stills): linux-projects.org/uv4l/installation
    – goldilocks
    Commented Jan 17, 2018 at 17:00

5 Answers 5

7

Another option with Raspbian is feh.

  1. connect from your pc with ssh -X [email protected] (capital X!)
  2. user@raspi:~ $ feh /path/picture.jpg

Note: loading is not superfast, wait patiently.

If the package feh is missing, you can install it via cli:

sudo apt-get update; sudo apt-get install feh

1
  • feh works but fbi and pqiv do not. Thanks Commented Jan 24, 2018 at 21:06
5

Displaying a picture via ssh taken literally:

Install libsixel-bin on the PI and use a sixel enabled terminal on the PC. Debian's XTerm can do this, so probably Ubuntu's XTerm too.

Add this to your $HOME/.Xresources on the PC:

XTerm*decTerminalID: vt340
XTerm*numColorRegisters: 256

Sixel over SSH

More info about Sixel stuff is at github.com/saitoha/libsixel.

2

If you have default Ubuntu install you can "mount" your Raspberry with SSH connection, and browse it easily like local directories.

In Nautilus (default file browser) edit the Location (press Ctrl+L to focus Location Bar), enter something like this:

sftp://username@host:port/path

For example:

Screenshot showing sftp usage

You may omit port if its SSH's default 22, and of course you can use literal host_name if you have DNS or host_name.local if your LAN machines use mDNS.

0
1

From your Ubuntu machine

xhost +
ssh -X pi@<rasp_ip>

Once you are connected, calling your graphic applications will open them on your connecting computer.

9
  • That works for the test application xeyes for example. However I tried with fbi and fim to open a jpg image: both returned a similar error: ioctl VT_GETSTATE: Inappropriate ioctl for device. This seems to be generated by the fact that fbi and fim writes directly to the frame buffer and they expect to find a device connected to the raspberry. Commented Jan 17, 2018 at 22:35
  • @FrancescoBoi I'not familiar with fbi application and you may be right about siplaying directly to framebuffer but you can use pqiv to display with with X. sudo apt-get install pqiv. Commented Jan 17, 2018 at 22:58
  • Hi, thanks for your answer. Your answer seems good. However I am getting some errors and warnings (even when I log in with ssh or update) about locales settings. I think the locales problems are affecting also this prolem so I will try to solve the locales problems and then come back here. Commented Jan 19, 2018 at 13:19
  • @FrancescoBoi locale errors are about language, code page, etc. They should not affect the display of images. Here is an article about locale raspberrypi.org/forums/viewtopic.php?t=11870 Commented Jan 19, 2018 at 17:38
  • @teoguso -X is not deprecated but -Y has a different objective. Please refer to man.openbsd.org/ssh. I have not tested -Y yet. Commented Jan 19, 2018 at 22:31
0

The easiest way I am aware of is UV4L, because you can get a video stream or JPEG pictures in real-time of what the Raspberry Pi is displaying on the HDMI screen connected to it (or would be displaying, if you do not have an HDMI screen connected). It's easy because you just open the browser and type the correct URL (e.g. http://rpi_address:8080/stream/webrtc) to start the stream in the page. There is also a button to record the video in standard .webm. Furthermore, it's possible to send key strokes from your PC to the Raspberry Pi to control it from within the browser itself, but this is another story. You do not necessarily need an X server running on your Rpi.

To do this, you will have to install the raspidisp driver by following these instructions which mention this about raspidisp at the bottom of the page:

The raspidisp driver turns HDMI-out into a virtual Video4Linux-compliant input device (like a camera). You do not necessarily need a display connected to the Raspberry Pi HDMI-out port. In other words, this driver can capture whatever you see or would see on the screen.

This is useful if you have an headless Raspberry Pi. With the help of the UV4L Streaming Server you can have full control of the Raspberry Pi from within any browser (running on a PC in the same network, for example). In facts, it’s possible to stream the frame buffer of Raspberry Pi to a standard web page in the browser (plugin-free) with very low latency and, at the same time, forward keyboard or mouse input events from the PC to the Raspberry Pi. If you want to try this, apart from uv4l-raspidisp, the uv4l-raspidisp-extras package has to be installed:

$ sudo apt-get install uv4l-raspidisp-extras

The above package includes a system service that automatically starts an uv4l instance at boot and, if installed, also an instance of the Streaming Server listening to port 9080 by default. The service instructs uv4l to parse the configuration file /etc/uv4l/uv4l-raspidisp.conf for the initial setting values.

This is a DEMO, more focused on showing its read-time capabilities, but you can get the idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.