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.


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

[Skip to ReadMe]


Dependenciesbase (>=4.7 && <5), brick (>=0.34.1 && <0.35), brick-image, conduit (>= && <1.4), data-default (>= && <0.8), directory (>= && <1.4), imagesize-conduit (==1.1.*), lens (>=4.16.1 && <4.17), typed-process (>= && <0.3), vector (>= && <0.13), vty (==5.20.*) [details]
AuthorPavan Rikhi
Home page
Bug tracker
Source repositoryhead: git clone
UploadedSun Dec 23 20:05:18 UTC 2018 by lysergia



Maintainers' corner

For package maintainers and hackage trustees

Readme for brick-image-

[back to package description]


brick-image&#39;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


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.


* 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

* How to release on hackage & stackage?

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


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