Coder Social home page Coder Social logo

akazukin5151 / ueberzug-hs Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 459 KB

Haskell bindings for ueberzug to display images in the terminal

Home Page: https://hackage.haskell.org/package/ueberzug

License: MIT License

Haskell 100.00%
terminal drawing ueberzug

ueberzug-hs's Introduction

ueberzug-hs

Hackage

Documentation

Haskell bindings for ueberzug to display images in the terminal

Make sure ueberzug is installed in the system path.

Note: ueberzug only works on Linux

Port of Ueberzug-rs

Examples

This draws the example image for 2 seconds, then clear it and wait for 1 second before exiting

import Control.Concurrent
import Graphics.Ueberzug

main = do
  ub <- newUeberzug
  -- assert it suceeded
  Right () <-
    draw ub $ defaultUbConf
      { identifier = "75933779_p0"
      , path = "./test/75933779_p0.jpg"
      , x = 10
      , y = 2
      , width = Just 10
      , height = Just 10
      , scaler = Just FitContain
      }
  threadDelay 2000000

  clear ub "75933779_p0"
  threadDelay 1000000

This draws the example image for 1 second, draws another one next to it for 1 second, clear the first image, wait 1 second, then clear the second image, and wait 1 second before exiting

main = do
  ub <- newUeberzug
  draw ub $ defaultUbConf
    { identifier = "75933779_p0_0"
    , path = "test/75933779_p0.jpg"
    , x = 10
    , y = 2
    , width = Just 10
    , height = Just 10
    , scaler = Just FitContain
    }
  threadDelay 1000000
  draw ub $ defaultUbConf
    { identifier = "75933779_p0_1"
    , path = "test/75933779_p0.jpg"
    , x = 20
    , y = 2
    , width = Just 10
    , height = Just 10
    , scaler = Just FitContain
    }
  threadDelay 1000000
  clear ub "75933779_p0_0"
  threadDelay 1000000
  clear ub "75933779_p0_1"
  threadDelay 1000000

Note that CI tests will fail on Hackage because there is no tty attached. They only work if manually ran.

License

MIT

ueberzug-hs's People

Contributors

akazukin5151 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.