File terminalimageviewer.spec of Package terminalimageviewer
#
# spec file for package terminalimageviewer
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: terminalimageviewer
Version: 1.1.0git20210308
Release: 0
Summary: Small C++ program to display images in a (modern) terminal
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License: Apache-2.0
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Productivity/Graphics/Viewers
Url: https://github.com/stefanhaustein/TerminalImageViewer
Source: TerminalImageViewer-master.zip
BuildRequires: ImageMagick-devel
BuildRequires: unzip
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
There are various similar tools (such as timg) using the unicode half block character to display two 24bit pixels per character cell. This program enhances the resolution by mapping 4x8 pixel cells to different unicode characters, using the following algorithm:
For each 4x8 pixel cell of the (potentially downscaled) image:
Find the color channel (R, G or B) that has the biggest range of values for the current cell
Split this range in the middle and create a corresponding bitmap for the cell
Compare the bitmap to the assumed bitmaps for various unicode block graphics characters
Re-calculate the foreground and background colors for the chosen character
%prep
%setup -qn TerminalImageViewer-master
%build
cd src/main/cpp
make %{?_smp_mflags}
%install
cd src/main/cpp
install -d %{buildroot}/usr/bin
cp tiv %{buildroot}/usr/bin/tiv
%post
%postun
%files
%defattr(-,root,root)
%doc README.md
%license LICENSE
%{_bindir}/tiv
%changelog