Viewer for huge images under linux (>100 MP color images)

20
2014-03
  • osgx

    I have a lot of 50-100 MP colour images that I would like to view on linux.

    For example, 10000x17000 size is typical, but most image viewers will fail with out-of-memory.

    The file format is png or jpg.

    What I want is the ability to view such image in part and in whole, with the ability to scroll around the image. Low memory consumption, so no full image unpacked into bitmap in memory.

  • Answers
  • Mechanical snail

    Gwenview

    This is the default KDE image viewer. I just tried it on a 128-megapixel color JPEG (my OS is 32-bit). Gwenview loaded the image about 1 second.

    • It loads the image zoomed out initially. The process is using only 55.8 MB of memory, so clearly it hasn't loaded the full uncompressed image data.

    • At 100% zoom, it is quite snappy when I pan the image. The process is now using 520 MB of memory, which is slightly more than the 489 MB the uncompressed 32-bit image would take up.

    However, with images of the size you described, loading the whole thing in memory is tractable on a recent computer. (The 32-bit addressing limit is 3 GB on Linux.)

    ImageMagick

    ImageMagick supports processing huge images without storing it all in memory.

    To do this, use

    display -limit memory 256mb huge_img.png
    

    (replace 256mb with however much memory you want to use). ImageMagick will store the remainder of the pixel data on disk (/tmp/magick-12345678), so that it doesn't have to hold it all in memory.

    It seems to be slower than Gwenview, but you might prefer it if you don't want to install all of Gwenview's KDE dependencies, or are heavily resource-constrained.

  • Nelson Asinowski

    The compressed jpgs may only be 50 meg but the pure raster would be about 700 meg. Given 32 bit OSs can only access 2 or 3 gigs of memory in a process ... With the OS load and the graphics program there may not be room.

    The question is do the images tools you are using work with a raster internally. To do the windowed viewing the tools would need bit by bit access to the jpg data. I don't know if that is possible.

    Can you try this on a 64 bit OS with 8 or 16 gig memory. If it works there then you know that they are expanding the jpg.


  • Related Question

    Command line SVG and image file viewer in Linux?
  • Xiè Jìléi

    Is there any command line (pipe-able) graph viewer for SVG and JPG/PNG image files?

    Especially that, the graph/image files are output thru pipe line, rather than plain files, so there must be option to specify the file type/extension.

    Though gv works for PS/PDF generated by dot programs, I'd like to know whether there's alternatives for support SVG etc. image files.


  • Related Answers
  • Dennis Williamson

    Have you tried the display program that comes with ImageMagick?

  • Ivan Petrushev

    What do you mean with 'pipe-able'?
    feh is very good commandline viewer with tons of options.

  • Jukka Matilainen

    I second Dennis Williamson's recommendation of ImageMagick display.

    Also, you can sometimes use named pipes to pipe data to programs which read from a file.

    Example:

    mkfifo /tmp/foo.svg
    cat /usr/share/inkscape/clipart/tux.svg > /tmp/foo.svg & inkscape /tmp/foo.svg
    rm -f /tmp/foo.svg
    

    Won't work with programs which expect to be able to seek backward in the file, though.

  • sdaau

    I usually work with SVG as text files, so would like the viewer to automatically refresh the display as soon as the file got saved (and its contents got changed) - this should be applicable to 'pipable' situations, I think (i.e. with named pipes).

    Note that, for default Gnome apps:

    • evince currently works like this for PDFs, but seemingly it cannot read SVG (for me it generates "Unable to open document - Error opening file: Permission denied" when I tried to load SVG files)
    • eog (Eye Of Gnome) - the latest versions - can also detect if a file changed on this, and then offer a 'Reload' button; but apparently, you'd still have to click on 'Reload' each time (I cannot see a way to cause automatic reload always on file change in eog, like evince behaves with PDFs) - and also, at least on my Ubuntu 10.04, eog SVG support is somewhat broken (zoom in results with blurry lines)
    • ImageMagick's display not only does not automatically refresh when the file changes on disk - and even when you press 'refresh' in display, you still do not get the latest version of the file (meaning, you have to restart display to show the latest version :( ).

    Here are some more notes I found so far:

    • Squiggle, the SVG Browser The SVG browser that is part of the Batik toolkit. - Download Batik batik-1.7.zip; unpack it; run java -jar batik-squiggle.jar and there it is; does not refresh the image automatically if the svg file changed on disk
    • SVG Image Viewer? - Ubuntu Forums recommendations:
      • In post #8 - "I wrote a little python script ... You just run it as: svg_compare.py and it opens up an svg and displays it using an svg library and using gtk's raster library. You can zoom with the mouse..."
      • xsvg (from http://cairographics.org) - I installed libsvg1_0.1.4-1_i386.deb, libsvg-cairo1_0.1.6-5_i386.deb and xsvg_0.2.1-3_i386.deb in that order; those versions are from 2005, and so xsvg is extremely simple - no zoom, nothing.. And needless to say, it does not react to saved file changes automatically...
    • through that, I found rsvg-view, which I think is a part of sudo apt-get install librsvg2-bin. Its small, nice, supports stdin - however, also rsvg-view cannot detect a file change, and automatically refresh on it..

    Yup - well, I hope this helps...
    Cheers!

     

    EDIT (Dec 24 '10): well, here is also my contribution: svg_refreshview.py - which is basically a rework of svg_compare.py mentioned above, that simply shows an SVG file, and reloads the file and refreshes the display if the file has been modified. (it can't really work with stdin - but there are other scripts in my repo that parse stdin in python, maybe they'll help).

    EDIT2 (May 20 '12): Also, came up with a Perl-Tk script example, which is very crude (no mouse interaction, no nothing), but uses ImageMagick Perl API, and so can render SVG (as bitmap on a canvas), please see answer #10670039 - ImageMagick API for command-line GUI application interface to display - Stack Overflow.

  • terdon

    It seems Geeqie viewer handles svg graphics and it automatically loads the updated images. I don't know whether it can take images from stdin. I hope it helps.

  • Denilson Sá

    Inkscape already comes with its own viewer: inkview

    It lacks features, it might be a bit slow, but it works (and probably renders SVG more accurately than ImageMagick's display).