{"id":16592692,"url":"https://github.com/prikhi/brick-image","last_synced_at":"2026-02-24T06:33:48.818Z","repository":{"id":80049205,"uuid":"130168891","full_name":"prikhi/brick-image","owner":"prikhi","description":"Show Images in Your Brick TUI Using w3mimgdisplay","archived":false,"fork":false,"pushed_at":"2021-07-31T03:29:02.000Z","size":137,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-02T01:03:04.313Z","etag":null,"topics":["brick","haskell","images","library","tui","w3m","w3mimgdisplay"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prikhi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-19T06:28:06.000Z","updated_at":"2023-12-07T20:28:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d79f513-195c-4192-9e49-111157123551","html_url":"https://github.com/prikhi/brick-image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fbrick-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fbrick-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fbrick-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fbrick-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prikhi","download_url":"https://codeload.github.com/prikhi/brick-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238803533,"owners_count":19533333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brick","haskell","images","library","tui","w3m","w3mimgdisplay"],"created_at":"2024-10-11T23:21:57.597Z","updated_at":"2025-10-29T10:30:36.853Z","avatar_url":"https://github.com/prikhi.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# brick-image\n\n[![brick-image's Travis-CI Build Status](https://travis-ci.org/prikhi/brick-image.svg?branch=master)](https://travis-ci.org/prikhi/brick-image \"brick-image on travis-ci.org\")\n\nRender raw images as [Brick](https://github.com/jtdaugherty/brick) widgets\nusing [w3mimgdisplay](https://github.com/tats/w3m/blob/master/w3mimgdisplay.c).\n\n![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.](/screenshot.png?raw=true \"brick-image Example Image Viewer\")\n\nThis is a super-rough, buggy first attempt at making this work.\n\nYou will need to have `w3m` installed.\n\nYou can use the `W3mImgDisplay` module to render images yourself, and the\n`Brick.Widgets.Image` module to render an image in Brick.\n\nBoth the manual rendering \u0026 brick rendering are working fine. However,\ntransformation from Brick's position/size data to pixels is currently hardcoded\nfor my terminal font. And the image isn't always completed cleaned up when\nchanged.\n\nThere is a small example app in `example/` that implements an Image Viewer for\nthe current directory using Image \u0026 List widgets:\n\n    stack build\n    # Assuming you have image files in ~/Pictures\n    cp ~/Pictures/*.jpg .\n    stack exec brick-image-example\n\n\n## TODO\n\nComments, design feedback, PRs, \u0026 bug reports are all appreciated.\n\nDecouple the row/column-\u003epixel conversion from my terminal font:\n\n* Quick, hacky version: `xrdb -q | grep -i font` will let us grab the font from\n  xresources, `XLoadQueryFont` will let us grab size details.\n* See xterm control sequence `\\e[14t`:\n  http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n* Also `xtermctl` or terminfo\n  https://stackoverflow.com/questions/22782703/how-to-get-terminal-size-or-font-size-in-pixels\n* The `w3mimgdisplay -test` command returns the width \u0026 height of the terminal\n  in pixels. Maybe use that if we can get total rows/columns from Vty module?\n\nFigure out when we should be using the `RedrawImage` command.\n\nFix the brick widget rendering - when side-by-side w/ a list widget that\nchanges the selected items color, a line will be missing from the image\nwhenever the list is scrolled. This is visible in the example app. I was able\nto fix this by adding a delay before calling w3mimgdisplay `forkIO $\nthreadDelay 50000 \u003e\u003e imageDisplay i` but that seems like a very hacky solution.\n\nFix the brick widget clearing - sometimes a tiny sliver of the bottom or left\nof the image doesn't get cleared when changing the file path. Probably requires\nsending `TerminateDrawing` via the \"server\" described below. This is visible in\nthe example app.\n\nFix image rendering on startup. Images aren't displayed on app startup becaue\ntheir viewports have no extents yet. Not sure how to work around this, seems\nlike we'd need to trigger an update after the initial rendering... This is\nvisible in the example app.\n\nWork on the library interface, it's currently just the minimum I needed to make it\nwork.\n\nHave `W3mImgDisplay` implement a \"server\" that keeps a long-running\nw3mimgdisplay process open \u0026 feeds it Commands received from a Chan or\nTChan(might need this for clearing images correctly).\nEventually it could have a really high-level interface that manages images \u0026\nmoving/clearing/layering them, etc.\n\nFigure out potential arguments by inspecting `w3mimgdisplay` source - add\n`Options` or `Config` type \u0026 `runWithOptions` that allows library users to pass\narguments to launched process.\n\nModule/usage documentation.\n\nTests\n\n    * ensure command output has correct number of fields\n    * ensure setting parameter sets correct output field\n\nStick un-exported functions into `Internal` modules?\n\nRename github repo to `hs-w3mimgdisplay`.\n\nRelease on hackage/stackage once working properly\n\n    * http://taylor.fausak.me/haskell-package-checklist/\n    * http://fvisser.nl/post/2013/may/28/towards-a-better-haskell-package.html\n    * https://wiki.haskell.org/How_to_write_a_Haskell_program\n    * How to release on hackage \u0026 stackage?\n\nLofty goals would be eventually re-implementing w3mimgdisplay in Haskell.\n\n\n## LICENSE\n\nGPL-3.0, but I could loosen it up if it means more people get to use this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprikhi%2Fbrick-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprikhi%2Fbrick-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprikhi%2Fbrick-image/lists"}