Resurrecting `xv` ... the original Linux image viewer

Resurrecting xv … the original Linux image viewer

I have some old image manipulation software which uses the xv image viewer . It is not available in Debian , Arch or Void repos, so I decided to track down the source code and compile it.

I obtained the source code from here

It is beautiful clean coded C written by John Bradley back in the 1990’s.
It compiles virtually without modification on a modern 64 bit system, with one exception

The routine xvpng.c makes calls to the PNG image library
libpng which has changed its API since xv was written.
Considerable modification of xvpng.c was needed.
Otherwise, it is an easy compile, and I have a binary ( called xv) which seems to run correctly.

Here is what it looks like, if you type xv with no parameters you get

and you then have to right click on that window to get the control menu

and from the control menu you can use Load to load an image

I have selected a .png image in my ~/Pictures folder.
If I press OK , I get the image displayed

However that is the pedestrian way to use it. If you type
xv imagename
it immediately brings up the image display menu.
and, if you want the control menu , right click on the image display.

Some things the control menu can do

  • crop
  • rotate and mirror
  • filtering algorithms
  • add text to image
  • put image on the root window
  • report image info
  • resize the display window
  • change color modes.
  • save image to various formats

I have tested reading the following image file types

  • pbm
  • pgm
  • png
  • rast ( sun rasterfile)
  • tiff
  • jpeg

they all work for me.

Getting xv

If you would like to try xv there are several options

  1. Download my x86-64 binary from my github repo

You will find there all the source code files (*.c and *.h), plus a file called ‘xv’ which is an x86_64 binary. It is 1.08Mb. If you download it in raw mode, change its permissions to execute (chmod 755 xv), and place it somehere like ~/bin or /usr/local/bin, it should execute when you type xv.
As always, if you download any binary, virus scan it.
xv does have dependencies. Here is the complete list of libraries needed for startup

$ ldd ./xv
	linux-vdso.so.1 (0x00007ffe11b85000)
	/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f72e1119000)
	libtiff.so.6 => /usr/lib/x86_64-linux-gnu/libtiff.so.6 (0x00007f72e1069000)
	libjpeg.so.62 => /usr/lib/x86_64-linux-gnu/libjpeg.so.62 (0x00007f72e0fd6000)
	libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f72e0fa0000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f72e0f81000)
	libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f72e0abe000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f72e09df000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f72e07fe000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f72e0f7a000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f72e0f75000)
	libwebp.so.7 => /usr/lib/x86_64-linux-gnu/libwebp.so.7 (0x00007f72e078c000)
	libzstd.so.1 => /usr/lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f72e06d0000)
	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f72e06a1000)
	libLerc.so.4 => /usr/lib/x86_64-linux-gnu/libLerc.so.4 (0x00007f72e0609000)
	libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f72e0f62000)
	libdeflate.so.0 => /usr/lib/x86_64-linux-gnu/libdeflate.so.0 (0x00007f72e05e3000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f72e1124000)
	libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f72e05b9000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f72e0200000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f72e0599000)
	libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f72e0f5b000)
	libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f72dfe00000)
	libbsd.so.0 => /usr/lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f72e0583000)
	libmd.so.0 => /usr/lib/x86_64-linux-gnu/libmd.so.0 (0x00007f72e0576000)

Those would be present in most full Linux installs ( my Debian and MX have all these present) , but if you have some minimal Linux install, some of these libraries may be missing and would need to be installed.

  1. Compile xv yourself.
    You may want to do this if you want xv for a different architecture.
    You could start with my source code from my github repo

or you could start from the original source from which I obtained code

or there is one other site which keeps xv code

http://www.trilon.com/xv/downloads.html

and they also have a binary i386 architecture in an rpm file ( I have no idea how old this binary is).

  1. There is a snap download available

I have not tried it.

  1. There is an xv package available in OpenSUSE

openSUSE Software

Documentation

xv comes with a very comprehensive manual. It is in the doc subdirectory on my github site

The file is xvdocs.pdf.
When you try to view it on Github, it says it cant read the .pdf file, but if you download it ( go to …, then Download) it will download to your Downloads directory, and a display will start using your local .pdf viewer.

6 Likes

Thanks for that gem @nevj, your posts are normally very informative and interesting.
I look forward to more.

Regards
Gary

2 Likes

Hi @Gary ,
Thank you for kind words…
More, in this case may mean learning how to make a .deb file… if enough people are interested
Regards
Neville

1 Like

Hi Neville, :wave:

I´m not sure whether it´s quite the same but for Arch Linux I think I found xv in the AUR repositories:
AUR (en) - xv .

Package Details: xv 5.2.0-1

Package Base: xv
Description: A nice image viewer
Upstream URL: GitHub - jasper-software/xv: XV Software
[…]

The reference to GitHub - jasper-software/xv: XV Software lists the following:

The XV software was originally written by John Bradley.

So it seems xv should be available for Arch.

Notwithstanding the above I absolutely admire the impressive work you´ve done, Neville. :+1:
Congratulations. :fireworks:

Many greetings from Rosika :slightly_smiling_face:

2 Likes

That will be a challenge I won’t be taking.
Too much to learn in my case.

1 Like

Hi Rosika,
Thanks, I did not search AUR. It is not in the official Arch repo. My Artix can not find it, but I dont have AuR set up.
That makes Arch an easy option for someone to try xv.

Give it a try. It is better than most of the viewers that come with distro installs.

Regards
Neville

Regards
Neville

2 Likes

Hi Neville, :wave:

thanks for the feedback.

That´s quite some recommendation.
I may give it a try on my Arch Linux vm indeed.
I must add some pictures to the vm first in order to try it out. :wink:

Many greetings from Rosika :slightly_smiling_face:

1 Like

That jasper-software site seems to be more up to date than the one I used.
There might be a case for doing it all again starting from there.

2 Likes

Sorry, Neville.
I didn´t want to give you any trouble. :slightly_frowning_face:

All the best from Rosika :slightly_smiling_face:

1 Like

That is not trouble.
It all started when I needed a working xv in Devuan. I have that now.

2 Likes

Xv is shareware… that may be why it is not in the Debian repository.
Shareware does not guarantee source code availability, but in the case of xv the source code is available.
Where that puts it in relation to FOSS I do not know?
It does not stop me from sharing a binary or modified source or a package… so what is the difference?

1 Like

I loved using xv until it disappeared from most distros. If anyone wants a quick replacement using ImageMagick, here’s my “xv” script:

#!/usr/bin/php
<?php
$i = 1;
while ($i < count($argv)) {
          `display -resize 'x1150>' "$argv[$i]"`;
          $i++;
}

Works great on a 27" monitor.

3 Likes

Why use this when gimp is so much better at image changes, or am i missing something ?

Hi Neville, :wave:

I just updated/upgraded my Arch Linux vm and after that installed xv via the AUR repos.

It took some while as it was built from scratch, it seems. :wink:

I´ll stilly have to try it out.
The only thing I did for the moment was copy a .bmp image to the vm and view it with xv.
Works nicely. :smiley:

Mnay greetings from Rosika :slightly_smiling_face:

1 Like

I have some software that calls it for display purposes. The way it calls xv is complicated and difficult to change. It was easier to provide xv.
and
there is a nostalgia component.
and
its a challenge… I like C programming
and
it is portable… you could compile it for any system, even BSD.
and
there is no problem with well written old code… its quality does not degrade with time.

Yes, Gimp or ImageMagick will do more. Most other simple image viewers will do less… very few of them will crop. It is sort of in-between.

3 Likes

Can you try a .png image? That will test if it is later than my version.
It is really useful for cropping.

2 Likes

That is a php script.
Have never used php. … I could not see from where you got the display command.

OK, I could have cheated and made a substitute for xv
I enjoyed the challenge of resurrecting it.

2 Likes

Hi Neville, :wave:

Yes, I´ll give it a try and post the results here.

Cheers from Rosika :slightly_smiling_face:

Update:

Yes, it works with .png files as well:

That .png file is an image of clock-settings in my former Lubuntu installation.

xv´s version seems to be 6.0.0-1.
The programme itself says: 6.0.0.20240812

1 Like

What does its license file or header in each file say?

1 Like

Great, so your Arch version has later modifications than mine.
Thank you for trying that.

2 Likes