Skip to main content

Simple (archived) image viewer

Project description

SaltViewer

Very simple image viewer on tkinter.

Why

I need mcomix alternative. Thus this program is developed.

Support these.

  • Many image type
    • pillow
    • svg
  • Animation
    • GIF, PNG
    • duration auto adjustment
  • Trash command
  • Double page mode
  • Full screen mode
  • Keyboard shortcut
  • Repetition key
    • For example 100h means go to next 100 page.
  • Open archive files
    • Zip, Rar, 7z, Pdf
  • Trash image or archive

How to install

pip install salt-viewer

or

yay -S salt-viewer

I use python3.9.3. However it will work on old version greater than python3.5.

This scripts use these pip modules.

  • cairosvg
  • natsort
  • pdf2python
  • pillow
  • py7zr
  • pypdf3
  • rarfile
  • send2trash

And use these packages.

  • unrar(preferred), unar or bsdtar
    • For rarfile
  • poppler
    • For pdf2python

How to Use

Now you can use salt-viewer command.

salt-viewer <image file | archive file>

If you use linux, you should use alias for time saving.

alias sv=salt-viewer

Document

$ salt-viewer --help

usage: salt_viewer.py [-h] [--config CONFIG] [--icon] [--default_config] [--debug] [--fullscreen] [--prev_cache PREV_CACHE] [--next_cache NEXT_CACHE] [--fit_mode FIT_MODE] [--page_order PAGE_ORDER] [--double] [--upscale UPSCALE] [--downscale DOWNSCALE] path

SaltViewer

positional arguments:
  path                  image file or archive file

optional arguments:
  -h, --help            show this help message and exit
  --config CONFIG       configuration file path. default is <HOME>/.svrc
  --icon                write icon to path
  --default_config      write default configuration to path. salt-viewer --default_config
  --debug               run as debug mode. All log is printed.
  --fullscreen          run as fullscreen mode
  --prev_cache PREV_CACHE
                        number of previous page cache. Default is 4
  --next_cache NEXT_CACHE
                        number of previous page cache. Default is 10
  --fit_mode FIT_MODE   fit_mode. Both, Raw, Width, Height. Default is Both
  --page_order PAGE_ORDER
                        page order in double page mode. right2left or left2right. Default is right2left
  --double              Double page mode. Default is False.
  --upscale UPSCALE     Upscale algorithm. Nearest, Box, Bilinear, Hamming, Bicubic, Lanczos. Default is Lanczos.
  --downscale DOWNSCALE
                        Downscale algorithm. Nearest, Box, Bilinear, Hamming, Bicubic, Lanczos. Default is Lanczos.

How to use

The only way to control SaltViewer is key press. You can custamize keymaps by argments or config file.

How to Use SaltViewer in default keymap. But you can custamize via Basic keymaps.

  • Page movements
    • NextPage: h. Support repetition.
    • PrevPage: l. Support repetition.
  • Archive movements
    • NextArchive: j. Not support repetition.
    • PrevArchive: k. Not support repetition.

If you open image file in directory, NextArchive and PrevArchive command is works as NextPage and PrevPage. This command is assumed to use when opening a archive file like zip.

Config file

Support config file. Default reading place is ~/.svrc.

You can write default default config file by running this command option.

salt-viewer --default_config ~/.svrc

Be careful, this command do NOT overwrite a existing file.

Keymap

You can change these keymaps via configuration file.

[Keymap]

DoublePage  = d
TrashFile   = Delete

# You can use repetition for NextPage and PrevPage.
# For example, 2h means goto next 2 page, type 100h go to next 100 page.
# If you want to reset number, type <Esc>, <Ctrl+[> or simply <[>
NextPage    = h
PrevPage    = l

NextArchive = j
PrevArchive = k

FitNone     = N
FitWidth    = W
FitHeight   = H
FitBoth     = B

PageOrder   = o

Head        = g
Tail        = G

Quit        = q
FullScreen  = f
Reload      = r

Setting

You can change these settings via configuration file.

[Setting]

# None, Width, Height or Both
DefaultFitMode = Both
DefaultFullScreen = True

# true or false.
DoublePage = False

# right2left or left2right
PageOrder  = right2left

# Resize algorithms
# | Filter   | Downscaling quality | Upscaling quality | Performance |
# | Nearest  | -                   | -                 | *****       |
# | Box      | *                   | -                 | ****        |
# | Bilinear | *                   | *                 | ***         |
# | Hamming  | **                  | -                 | ***         |
# | Bicubic  | ***                 | ***               | **          |
# | Lanczos  | ****                | ****              | *           |

UpScale     = Lanczos
DownScale   = Lanczos

Page Cache

SaltViewer's page cache do something strange.

SaltViewer read previous and next pages around a current page. For speed, this preload is running on an other thread.

Preload thread read by one page, or half of self.next_cache pages not unpreloaded number of pages. And automatically deleted out of range pages.

Sometimes getitems may takes too much time and preload cache use used in getitems. Thus preload should be as many as possible.

If you make next_cache and prev_cache too much, it will occupy memory and make your PC freeze. This problem happens when you tried to open high quality files.

Icon

You can create SaltViewer Icon by running.

salt-viewer --icon icon.svg

Icon format is svg only. Suffix is ignored.

Yet Implemented

  • Pre resize and convert
    • Big images takes time to resize and convert to tkImage
    • And do resize in preload
  • Zoom in and Zoom out image
  • Move around images

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

salt-viewer-0.1.4.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

salt_viewer-0.1.4-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file salt-viewer-0.1.4.tar.gz.

File metadata

  • Download URL: salt-viewer-0.1.4.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for salt-viewer-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a17b5a43462714a17e7f8c4c2c6ad611c2b38df3b3eb103cd7f7d45bbb658be8
MD5 9ac8d1ebca3f795b6e8ccef11e92fcdb
BLAKE2b-256 92f8d99850deae0411c62fbee18f365f88d56a67b0f911ea07decfe0a6a307e8

See more details on using hashes here.

File details

Details for the file salt_viewer-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: salt_viewer-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for salt_viewer-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b92e6a8f56b21da91ff35364a285dd4667fc8930266d49ac593e04642202bdde
MD5 36d32e517850de9ec1b253e3e63176e6
BLAKE2b-256 c07914e019d90585502e2417d148959e2245c0194e51bb9830fd2681de585750

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page