Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9ae36a8
refactor package structure
t-bltg Dec 20, 2021
3808ad4
lena -> monarch
t-bltg Dec 20, 2021
58ef9b4
indent
t-bltg Dec 20, 2021
3d49d58
remove duplicate test files
t-bltg Dec 21, 2021
86968ff
revert adding TerminalGraphicDisplay
t-bltg Dec 21, 2021
0de3a47
rework
t-bltg Dec 21, 2021
6b9bcfa
IOBuffer -> PipeBuffer
t-bltg Dec 21, 2021
0541643
fix regression
t-bltg Dec 21, 2021
e57cb1d
revert format change
t-bltg Dec 21, 2021
944c719
change readme name
t-bltg Dec 21, 2021
d432a58
move imshow to AsciiPixel
t-bltg Dec 22, 2021
7326b58
256 -> 8bit, rework test, rework imgshow
t-bltg Dec 22, 2021
ac58920
rename ascii_encode -> ascii_display when using io, rework downscale
t-bltg Dec 22, 2021
ecdf555
checkpoint downscale
t-bltg Dec 22, 2021
adeda2c
rework ImageEncoder structure
t-bltg Dec 22, 2021
a0f6ec6
allow direct encoding to io
t-bltg Dec 22, 2021
ac5d96f
update docstrings
t-bltg Dec 22, 2021
3ee1608
add tests for ascii_display
t-bltg Dec 23, 2021
b7e987b
improve docs, reduce dependencies
t-bltg Dec 23, 2021
ada1b15
properly deprecate imsho256 and imshow24bit - unify trail_nl
t-bltg Dec 23, 2021
3e3e173
drop docstring for downscale_XXX, moved to comment
t-bltg Dec 23, 2021
0d1e0b5
use custom print function for Crayons
t-bltg Dec 23, 2021
46a06aa
simplify test ascii
t-bltg Dec 23, 2021
5d47e33
fix broken ensurecolor macro
t-bltg Dec 23, 2021
01be801
fix reg - maxsize unused in imshow
t-bltg Dec 24, 2021
ff6e386
checkpoint
t-bltg Dec 24, 2021
a7ca493
fix typo
t-bltg Dec 24, 2021
412adb2
monarch.png -> mandril.tif, drop ImageIO
t-bltg Dec 26, 2021
72b71ab
restore ImageIO
t-bltg Dec 29, 2021
ead17f0
rebase: fix import - fix tests
t-bltg Aug 6, 2022
3f62dd1
update workflows
t-bltg Aug 6, 2022
1721ca7
reorganize tests - hard `Sixel` dependency - format check
t-bltg Aug 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
style = "blue"
short_to_long_function_def = false
always_use_return = false
import_to_using = false
align_struct_field = true
align_conditional = true
align_assignment = true
align_pair_arrow = true
35 changes: 11 additions & 24 deletions .github/workflows/UnitTest.yml → .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
name: Unit test
on:
create:
tags:
push:
branches:
- master
pull_request:
name: CI
on: [push, pull_request]
defaults:
run:
shell: bash

jobs:
test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
Expand All @@ -31,20 +24,14 @@ jobs:
version: '1'

steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/cache@v1
- name: Test AsciiPixel
run: |
julia --project -e 'using Pkg; Pkg.develop(path="AsciiPixel")'
julia --project -e 'using Pkg; Pkg.test("AsciiPixel")'
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
7 changes: 6 additions & 1 deletion .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: 3
permissions:
contents: write
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand All @@ -12,4 +17,4 @@ jobs:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.TAGBOT }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
39 changes: 39 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: format-check

on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:

jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1']
julia-arch: [x64]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v3
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(["src", "test"], verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
23 changes: 23 additions & 0 deletions AsciiPixel/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name = "AsciiPixel"
uuid = "d64ea8f1-9d40-4cda-bb88-5de2505cd5c8"
version = "0.1.0"

[deps]
Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
ImageBase = "c817782e-172a-44cc-b673-b171935fbb9e"

[compat]
Crayons = "1 - 4"
ImageBase = "0.1"
julia = "1.6"

[extras]
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
ImageTransformations = "02fcd773-0e25-5acc-982a-7f6622650795"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"

[targets]
test = ["ImageIO", "ImageTransformations", "OffsetArrays", "ReferenceTests", "Test", "TestImages"]
3 changes: 3 additions & 0 deletions AsciiPixel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AsciiPixel

AsciiPixel is a backend for [ImageInTerminal](https://github.com/JuliaImages/ImageInTerminal.jl).
38 changes: 38 additions & 0 deletions AsciiPixel/src/AsciiPixel.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module AsciiPixel

using ImageBase
using Crayons

export ascii_display

include("colorant2ansi.jl")
include("ascii.jl")

const colormode = Ref{TermColorDepth}(TermColor8bit())

"""
set_colormode(bit::Int)

Sets the terminal color depth to the given argument.
"""
function set_colormode(bit::Int)
if bit == 8
colormode[] = TermColor8bit()
elseif bit == 24
colormode[] = TermColor24bit()
else
error("Setting color depth to $bit-bit is not supported, valid modes are:
- 8bit (256 colors)
- 24bit")
end
colormode[]
end

is_24bit_supported() = lowercase(get(ENV, "COLORTERM", "")) in ("24bit", "truecolor")

function __init__()
# use 24bit if the terminal supports it
is_24bit_supported() && set_colormode(24)
end

end # module
Loading