brick-image: Show images in your Brick UI with w3mimgdisplay.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

This package provides an ImageWidget for displaying real images in a Brick application, using w3mimgdisplay.

For more information, please see the Module documentation or the README on at https://github.com/prikhi/brick-image#readme.


[Skip to Readme]

Properties

Versions 0.1.0.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), brick (>=0.34.1 && <0.35), brick-image, conduit (>=1.3.0.2 && <1.4), data-default (>=0.7.1.1 && <0.8), directory (>=1.3.0.2 && <1.4), imagesize-conduit (>=1.1 && <1.2), lens (>=4.16.1 && <4.17), typed-process (>=0.2.2.0 && <0.3), vector (>=0.12.0.1 && <0.13), vty (>=5.20 && <5.21) [details]
License GPL-3.0-only
Copyright GPL-3.0
Author Pavan Rikhi
Maintainer pavan.rikhi@gmail.com
Category Graphics
Home page https://github.com/prikhi/brick-image#readme
Bug tracker https://github.com/prikhi/brick-image/issues
Source repo head: git clone https://github.com/prikhi/brick-image
Uploaded by lysergia at 2018-12-23T20:05:18Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for brick-image-0.1.0.0

[back to package description]

brick-image

brick-image's Travis-CI Build Status

Render raw images as Brick widgets using w3mimgdisplay.

A screenshot of a terminal running the example brick-image application, showing a list of files and an image preview of the currently selected file.

This is a super-rough, buggy first attempt at making this work.

You will need to have w3m installed.

You can use the W3mImgDisplay module to render images yourself, and the Brick.Widgets.Image module to render an image in Brick.

Both the manual rendering & brick rendering are working fine. However, transformation from Brick's position/size data to pixels is currently hardcoded for my terminal font. And the image isn't always completed cleaned up when changed.

There is a small example app in example/ that implements an Image Viewer for the current directory using Image & List widgets:

stack build
# Assuming you have image files in ~/Pictures
cp ~/Pictures/*.jpg .
stack exec brick-image-example

TODO

Comments, design feedback, PRs, & bug reports are all appreciated.

Decouple the row/column->pixel conversion from my terminal font. The w3mimgdisplay -test command returns the width & height of the terminal in pixels. Maybe use that if we can get total rows/columns from Vty module?

Figure out when we should be using the RedrawImage command.

Fix the brick widget rendering - when side-by-side w/ a list widget that changes the selected items color, a line will be missing from the image whenever the list is scrolled. This is visible in the example app. I was able to fix this by adding a delay before calling w3mimgdisplay forkIO $ threadDelay 50000 >> imageDisplay i but that seems like a very hacky solution.

Fix the brick widget clearing - sometimes a tiny sliver of the bottom or left of the image doesn't get cleared when changing the file path. Probably requires sending TerminateDrawing via the "server" described below. This is visible in the example app.

Fix image rendering on startup. Images aren't displayed on app startup becaue their viewports have no extents yet. Not sure how to work around this, seems like we'd need to trigger an update after the initial rendering... This is visible in the example app.

Work on the library interface, it's currently just the minimum I needed to make it work.

Have W3mImgDisplay implement a "server" that keeps a long-running w3mimgdisplay process open & feeds it Commands received from a Chan or TChan(might need this for clearing images correctly). Eventually it could have a really high-level interface that manages images & moving/clearing/layering them, etc.

Figure out potential arguments by inspecting w3mimgdisplay source - add Options or Config type & runWithOptions that allows library users to pass arguments to launched process.

Module/usage documentation.

Tests

* ensure command output has correct number of fields
* ensure setting parameter sets correct output field

Stick un-exported functions into Internal modules.

Split into a w3mimgdisplay package & a brick-image package.

Release on hackage/stackage once working properly

* http://taylor.fausak.me/haskell-package-checklist/
* http://fvisser.nl/post/2013/may/28/towards-a-better-haskell-package.html
* https://wiki.haskell.org/How_to_write_a_Haskell_program
* How to release on hackage & stackage?

Lofty goals would be eventually re-implementing w3mimgdisplay in Haskell.

LICENSE

GPL-3.0, but I could loosen it up if it means more people get to use this.