Merge branch 'master' of https://github.com/stefanhaustein/TerminalImageViewer
This commit is contained in:
commit
4b116332f7
94
.gitignore
vendored
Normal file
94
.gitignore
vendored
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
###C++###
|
||||||
|
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
tiv
|
||||||
|
|
||||||
|
|
||||||
|
###Java###
|
||||||
|
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
|
||||||
|
###Linux###
|
||||||
|
|
||||||
|
*~
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
|
||||||
|
###OSX###
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear on external disk
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
19
README.md
19
README.md
@ -9,9 +9,9 @@ For each 4x8 pixel cell of the (potentially downscaled) image:
|
|||||||
1. Find the color channel (R, G or B) that has the biggest range of values for the current cell
|
1. Find the color channel (R, G or B) that has the biggest range of values for the current cell
|
||||||
2. Split this range in the middle and create a corresponding bitmap for the cell
|
2. Split this range in the middle and create a corresponding bitmap for the cell
|
||||||
4. Compare the bitmap to the assumed bitmaps for various unicode block graphics characters
|
4. Compare the bitmap to the assumed bitmaps for various unicode block graphics characters
|
||||||
5. Re-calculate the foregound and background colors for the chosen character.
|
5. Re-calculate the foreground and background colors for the chosen character.
|
||||||
|
|
||||||
See the difference by disabling this optimization using the `-0` option. Or just take a look at the comparsion image at the end of this text.
|
See the difference by disabling this optimization using the `-0` option. Or just take a look at the comparison image at the end of this text.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -27,6 +27,13 @@ See the difference by disabling this optimization using the `-0` option. Or just
|
|||||||
|
|
||||||
The shell will expand wildcards. By default, thumbnails and file names will be displayed if more than one image is provided. To display a list of options, just run the command without any parameters.
|
The shell will expand wildcards. By default, thumbnails and file names will be displayed if more than one image is provided. To display a list of options, just run the command without any parameters.
|
||||||
|
|
||||||
|
## Packages / Contributions
|
||||||
|
|
||||||
|
- megamaced has created a RPM for SUSE:
|
||||||
|
https://build.opensuse.org/package/show/home:megamaced/terminalimageviewer
|
||||||
|
- bperel has created a Docker image:
|
||||||
|
https://hub.docker.com/r/bperel/terminalimageviewer
|
||||||
|
|
||||||
## Common problems
|
## Common problems
|
||||||
|
|
||||||
- If you see strange horizontal lines, the characters don't fully fill the character cell. Remove additional line spacing in your terminal app
|
- If you see strange horizontal lines, the characters don't fully fill the character cell. Remove additional line spacing in your terminal app
|
||||||
@ -34,15 +41,15 @@ The shell will expand wildcards. By default, thumbnails and file names will be d
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
![Examples](http://i.imgur.com/8UyGjg8.png)
|
![Examples](https://i.imgur.com/8UyGjg8.png)
|
||||||
|
|
||||||
If multiple images match the filename spec, thumbnails are shown.
|
If multiple images match the filename spec, thumbnails are shown.
|
||||||
|
|
||||||
![Thumbnails](http://i.imgur.com/PTYgSqz.png)
|
![Thumbnails](https://i.imgur.com/PTYgSqz.png)
|
||||||
|
|
||||||
## Comparison to Using Half-Block Characters Only
|
## Comparison to Using Half-Block Characters Only
|
||||||
|
|
||||||
The top image was generated with the character optization diabled via the `-0` option.
|
The top image was generated with the character optimization disabled via the `-0` option.
|
||||||
|
|
||||||
![Comparison](http://i.imgur.com/OzdCeh6.png)
|
![Comparison](https://i.imgur.com/OzdCeh6.png)
|
||||||
|
|
||||||
|
5535
src/main/cpp/CImg.h
5535
src/main/cpp/CImg.h
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,12 @@
|
|||||||
|
CXX=g++
|
||||||
|
|
||||||
default: tiv
|
default: tiv
|
||||||
|
|
||||||
tiv.o: tiv.cpp CImg.h
|
tiv.o: tiv.cpp CImg.h
|
||||||
g++ -std=c++17 -Wall -fpermissive -fexceptions -O2 -c tiv.cpp -o tiv.o
|
$(CXX) -std=c++17 -Wall -fpermissive -fexceptions -O2 -c tiv.cpp -o tiv.o
|
||||||
|
|
||||||
tiv : tiv.o
|
tiv : tiv.o
|
||||||
g++ tiv.o -o tiv -lstdc++fs -pthread -s
|
$(CXX) tiv.o -o tiv -lstdc++fs -pthread -s
|
||||||
|
|
||||||
install: tiv
|
install: tiv
|
||||||
cp tiv /usr/local/bin/tiv
|
cp tiv /usr/local/bin/tiv
|
||||||
|
@ -362,14 +362,14 @@ void emitCodepoint(int codepoint) {
|
|||||||
std::cout << (char) (0x80 | ((codepoint >> 6) & 0x3f));
|
std::cout << (char) (0x80 | ((codepoint >> 6) & 0x3f));
|
||||||
std::cout << (char) (0x80 | (codepoint & 0x3f));
|
std::cout << (char) (0x80 | (codepoint & 0x3f));
|
||||||
} else {
|
} else {
|
||||||
std::cout << "ERROR";
|
std::cerr << "ERROR";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void emit_image(const cimg_library::CImg<unsigned char> & image, int flags) {
|
void emit_image(const cimg_library::CImg<unsigned char> & image, int flags) {
|
||||||
for (int y = 0; y < image.height() - 8; y += 8) {
|
for (int y = 0; y <= image.height() - 8; y += 8) {
|
||||||
for (int x = 0; x < image.width() - 4; x += 4) {
|
for (int x = 0; x <= image.width() - 4; x += 4) {
|
||||||
CharData charData = flags & FLAG_NOOPT
|
CharData charData = flags & FLAG_NOOPT
|
||||||
? getCharData(image, x, y, 0x2584, 0x0000ffff)
|
? getCharData(image, x, y, 0x2584, 0x0000ffff)
|
||||||
: getCharData(image, x, y);
|
: getCharData(image, x, y);
|
||||||
|
Loading…
Reference in New Issue
Block a user