Inside the FIM (Fbi IMproved) Scriptable Image Viewer
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Subtitle |
| |
Title of Series | ||
Number of Parts | 542 | |
Author | ||
License | CC Attribution 2.0 Belgium: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/61488 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSDEM 20238 / 542
2
5
10
14
15
16
22
24
27
29
31
36
43
48
56
63
74
78
83
87
89
95
96
99
104
106
107
117
119
121
122
125
126
128
130
132
134
135
136
141
143
146
148
152
155
157
159
161
165
166
168
170
173
176
180
181
185
191
194
196
197
198
199
206
207
209
210
211
212
216
219
220
227
228
229
231
232
233
236
250
252
256
258
260
263
264
267
271
273
275
276
278
282
286
292
293
298
299
300
302
312
316
321
322
324
339
341
342
343
344
351
352
354
355
356
357
359
369
370
372
373
376
378
379
380
382
383
387
390
394
395
401
405
406
410
411
413
415
416
421
426
430
437
438
440
441
443
444
445
446
448
449
450
451
458
464
468
472
475
476
479
481
493
494
498
499
502
509
513
516
517
520
522
524
525
531
534
535
537
538
541
00:00
Data bufferKey (cryptography)Arrow of timeGastropod shellText editorEmailFile viewerComputer fileConfiguration spaceScripting languageComputer-generated imageryTask (computing)Cache (computing)User interfaceVideoconferencingAsynchronous Transfer ModeTouchscreenFrame problemASCIIComputer hardwareBuffer solutionPixelDenial-of-service attackKeyboard shortcutMereologySemiconductor memoryNeuroinformatikCASE <Informatik>Line (geometry)Computer filePatch (Unix)Software testingMoment (mathematics)Point (geometry)Condition numberGreatest elementMixed realityUser interfaceConfiguration spaceTouchscreenHacker (term)Multiplication signComputer animation
01:58
ConsistencyAsynchronous Transfer ModeFile viewerComputer-generated imageryAsynchronous Transfer ModeTouchscreenComputer configurationRun time (program lifecycle phase)WindowGraph coloringElectronic visual displayLine (geometry)Gastropod shellPhysical systemRoundness (object)Computer fileOpen setComputer animation
02:37
Key (cryptography)Interactive televisionFormal languagePersonal identification numberAsynchronous Transfer ModeComplete metric spaceComputer fileConfiguration spaceScripting languageBlock (periodic table)Statement (computer science)Regulärer Ausdruck <Textverarbeitung>Keyboard shortcutElement (mathematics)Function (mathematics)Gastropod shellFocus (optics)Entire functionComputer-generated imageryScale (map)Electronic mailing listAliasingIntegral domainGroup actionRange (statistics)Group actionComputer fileOpen setKeyboard shortcutRange (statistics)Interactive television1 (number)NumberSelectivity (electronic)Formal languageSlide ruleVariable (mathematics)Key (cryptography)DigitizingAliasingPosition operatorDirection (geometry)Online helpWeb pagePoisson-KlammerGame controllerPhysical systemScripting languageContent (media)ExpressionConfiguration spaceLatent heatDivisorDigital photographyFisher informationGreatest elementIterationFunctional (mathematics)Vulnerability (computing)Multiplication signScaling (geometry)Gastropod shellUtility softwareParameter (computer programming)Substitute goodElectronic mailing listArrow of timeInstance (computer science)Personal area networkType theoryEndliche ModelltheorieCASE <Informatik>Row (database)State of matterWater vaporForcing (mathematics)Block (periodic table)Line (geometry)Escape characterPlanningOperator (mathematics)Statement (computer science)ForestHypermediaMereologySystem callSocial classSound effectSI-EinheitenInterpreter (computing)Closed setControl flowComputer animation
09:26
Pairwise comparisonString (computer science)Operator (mathematics)Logical constantIntegerVariable (mathematics)Regulärer Ausdruck <Textverarbeitung>Random numberSpectrum (functional analysis)Read-only memoryFile formatWindowComputer-generated imageryClique-widthMatching (graph theory)Group actionEvent horizonAliasingPhysical systemTime zoneRange (statistics)Control flowInteractive televisionScripting languageParsingFormal grammarTraffic reportingError messageParsingFunction (mathematics)Complete metric spaceFormal languageComputer configurationFeedbackFingerprintFisher informationFormal languageMetadataWindowoutputString (computer science)Ocean currentVariable (mathematics)Game controllerFunction (mathematics)Flow separationInteractive televisionCodeComputer fileLine (geometry)Instance (computer science)Scripting languageFunctional (mathematics)Pattern languageDot productOperator (mathematics)Formal grammarParsingRow (database)ExpressionConfiguration spaceCombinational logicParameter (computer programming)Letterpress printingPoint (geometry)Reading (process)WritingDirectory serviceGastropod shellDistribution (mathematics)Electronic mailing listExtension (kinesiology)Poisson-KlammerLatent heatEvent horizonIdentifiabilityGroup actionMetropolitan area networkFerry CorstenCASE <Informatik>Data managementBookmark (World Wide Web)InformationComputer programmingRange (statistics)Bit rateRight angleMessage passingComplete metric spaceSystem callMultiplication signComputer configurationNumberPrice indexForcing (mathematics)Web pageCondition numberCodeSingle-precision floating-point formatDoubling the cubeFamilyComputer animation
16:16
Interactive televisionFormal languageComputer configurationFeedbackFingerprintIntelInteractive televisionLine (geometry)Category of beingMixed realityPresentation of a groupLevel (video gaming)Keyboard shortcutMappingVideoconferencingGroup actionFile archiverPoint (geometry)Logic gatePartial derivativeScripting languageElectronic mailing listSet (mathematics)Core dumpFood energySimilarity (geometry)Multiplication signComplete metric spaceFormal languageDegree (graph theory)Semiconductor memoryWave packetFisher informationComputer fileOrientation (vector space)BitRecursionHydraulic jumpOpen setExterior algebraLatent heatProbability density functionGastropod shellTranslation (relic)Computer animationProgram flowchart
23:16
BitBell and Howell2 (number)Vector potentialData conversionFisher informationGoodness of fitDifferent (Kate Ryan album)Library (computing)Row (database)Functional (mathematics)VideoconferencingCuboidProbability density functionSubstitute goodPlanningMoment (mathematics)PixelMultiplication signMathematicsFrame problemFile formatSelf-organizationScaling (geometry)Personal identification numberComputer programmingOpticsFamilyLimit (category theory)Arithmetic meanData managementProcess (computing)Source codeComputer animation
30:01
Computer animationProgram flowchart
Transcript: English(auto-generated)
00:15
Back in 2006, I was a user of Gert Hofmann's Linux framebuffer image viewer, FBI.
00:24
At some point, I wanted to add VIM-styled keys for movement. So, I came up with a patch for FBI. Soon after, I wanted a simple command line and shortcuts to jump around.
00:41
And then commands came, and a parser, and auto-completion. Inspiration came from VIM, MAT, the shell, and so VIM grew, hack after hack. What is VIM now?
01:03
VIM is a Unix tool specialized in viewing image files. Let me stress this. Viewing, not editing. VIM is customizable via configuration files, and is interoperable with other Unix tools.
01:23
VIM adheres to the PERS logon. There is more than one way to do it. Thanks to caching and prefetching, VIM plays well with slower computers. It spares discrete time.
01:41
It has a minimalistic user interface, no buttons, no menus. And it's flexible. It displays images as pixels or characters via SSH, under screen. If invoked in the Linux framebuffer, VIM uses it.
02:05
Under X11, VIM runs in a window or full screen. Another option is to display images as ASCII art, even in color. Runtime auto-detection will try choosing the most appropriate mode.
02:25
You can also specify one yourself via the command line. VIM offers a consistent look and feel across those different graphical modes. Invoking VIM from the shell to open image files works as you expect.
02:48
File decoding depends on file contents, not on the file name. You can also load directories, even recursively, or in the background.
03:00
In scanning a directory, a filename-based selection occurs. This is to avoid opening and inspecting contents of too many files. Interactive usage is keyboard-oriented. Arrow keys for movement, plus, minus for scale, N for next, P for previous, or page down.
03:29
They do what you expect. Each one of those keys is bound to an action. An action may be invoking a simple command, or a command with expressions as arguments.
03:47
An action can also contain control flow, as the one associated with page down on the bottom of the slide. The thing is, under the hood, there is a language interpreter.
04:02
Just as in VIM, you access it with the column key. And just as in VIM, or the shell, there is auto-completion. Configuration files are scripts written in this language.
04:22
The scripts language consists of commands, aliases, variables, control constructs, and special shortcuts. I develop VIM for my daily use, to occasionally open files, or to load a curated collection of photographs.
04:46
Sometimes I come up with more tricky use cases, perhaps updating the configuration file with new aliases. Or updating my shell configuration with new aliases using VIM.
05:06
So far, I talked about introductory topics, and also presenting at another talk at this FOSDEM. That talk is about general interactive usage, and it may be of your interest too. But now, we will cover language-specific topics.
05:26
Of the FIM commands, the most important ones are those to move around, scale the image, and get help. Purpose of the help-goto-scale-pan commands is self-explanatory.
05:44
Other important commands, like list or limit, manipulate the file list. Please check out my talk on interactive FIM usage for that. How to start using FIM commands effectively?
06:02
You usually pick the functionality you like, experiment a bit, and express it as an alias. This can be a command with argument, like pan left, or go 2 plus 1. Or it can be a more complicated statement.
06:22
Here you have next 10 for a simple slideshow loop. Notice how their arguments are quoted. The idea is to streamline your workflow.
06:41
No matter how complex an action, you should be able to encapsulate it. As Larry Wolf said, easy things should be easy, and hard things should be possible. FIM has each of its commands and variables documented.
07:04
The manual pages are generated from the help command. The help command is also dynamic, so you can use it to get the actual key bindings and aliases. Now, certain frequent actions have direct language shortcuts.
07:24
You may want to use those occasionally via the interactive command line. One is jumping to a specific position in the files list. So, for the third position, enter the command line with colon, enter digit 3, and hit enter.
07:48
For the first or the last one, you may recognize the caret and dollar syntax as familiar here.
08:00
The shortcuts of this slide instead are for rescaling images by specific factors. As you see, this exploits the fine-grained control that the scale command offers. What you see are standalone FIM statements, of course.
08:26
Another shortcut syntax prefixes a command by a number. The command, or a block, will be repeatedly executed that specific number of times.
08:40
One can interrupt the iterations by hitting escape, for instance. You can use a so-called range syntax to repeat an action on a file name interval. Just specify number comma number before a command.
09:03
Use this to invoke commands on file names, which will be substituted to open-close curly brackets. This usage of the brackets substitution mimics the syntax of the Unix find utility.
09:25
FIM uses dynamic variables and a weak type system. Internally, a variable can be an integer, a floating point number, or a string. You can combine expressions with several operators.
09:44
Strings concatenate with dot. There are two quoting styles for strings. Within single quotes, you only have to escape using backslash single quotes. Within double quotes, you escape double quotes.
10:04
FIM sets several variables, many meant to be used only internally. Some other variables are meant to be controlled by the user. These are the configuration variables and may, for instance, control caching behavior or customize the status line or the window manager caption.
10:28
In the case of the special variable random, think of it as it were a function. Certain variables prefixed by i colon are contextual to the current image.
10:46
They may hold its file name, size, or the current width, but also special information like EXIF metadata. I, for instance, really like to have those being displayed in the status line.
11:10
Variables are the glue of the language, but auto-commands are the glue of the FIM internals. Auto-commands, inspired by VIM, are actions that trigger if the current file name matches a pattern on a specific event.
11:33
There is a dozen of specific events defined in FIM. You have a list of them in the man FIMercy.
11:45
Auto-commands are tricky, but also very powerful. Now, remember the special range syntax? One must say, one can also use it to rudimentally interact with the shell from within FIM.
12:06
The example here repeats the copy command with a changing first argument. It copies each file into a specific directory. You can think the open-closed brackets as the i colon file name variable.
12:27
This feature is to be used with lots of care. By now, you know enough of the language that you can experiment in the internal command line.
12:42
You can also make FIM run custom scripts, or customize the configuration. It would be useful to know that FIM has command recording functionality. See the write script out option, for instance. With it, when terminating your usage session, FIM can save all the executed actions, along with timings, into a text file, a script.
13:11
You can then replay that session by executing that output script. Just remember that only executed commands are saved.
13:22
The actual invocation argument to FIM will not be there. Also worth to know, in your scripts, you can control the exit status. This is good for interaction with shell scripts. You can signal success or failure of a script.
13:45
Indeed, so far, we have mostly seen internal scriptability. But FIM has several command line options. There are many things you can do with them. And, interacting with shell pipes, you can read and execute a script via the standard input.
14:06
You can read images via the standard input. Or, perhaps, print file name lists as output of one FIM instance, and reading back as input in another FIM instance.
14:27
We are approaching the end of the talk. You might be curious and want to know that FIM consists of circa 42,000 lines of C++ code. The language parser has been written in Bizon and Flex.
14:45
And, well, details of the grammar are in Man FIM RC. FIM's language offer many possibilities. But this can be still improved a lot.
15:04
Variable identifiers are not always clear. Detecting mistakes in a program can be difficult. Output could be escaped or quoted better. Sometimes I wish less quoting were possible. Auto-completion could be richer.
15:22
And, wouldn't it be awesome to use your favorite extension or customization language instead of this one here? Well, this is the end of our tour of FIM's internal language.
15:41
FIM is packaged on several Linux distributions. So, you can check out yours to obtain FIM. The documentation is mostly inside two Man pages. And, perhaps, the other FIM talk I'm giving at this FOSDEM, specific about interactive usage, can be of your interest.
16:04
So, I hope you will be enjoying FIM as much as I do. Thanks for your attention. We are live now. We don't seem to have any questions.
16:36
You could add something if you have anything to add beyond the talk itself.
17:02
So, maybe I could ask questions like, did you consider using a Lisp-like language for FIM? And, why did you choose a specific kind of syntax?
17:21
I don't know if Lisp is a minimalistic language in that it requires a certain degree of parentheses, as far as I know. And, that is already too much or more than what I wanted.
17:40
I don't exclude the idea of having Lisp to interact with FIM in the future. But, still, I wanted to have minimalistic syntax, like the one that you have seen with the shortcut jump commands. I think you cannot have that in Lisp.
18:04
So, you wanted some, a little bit of a really short syntax. Okay. Yeah, that makes sense. I am referring to slide 14, no sorry, I am referring to slide 17 and 18.
18:22
Okay. There is a question by Piotr. Perhaps I can answer it straight away.
18:44
Yeah, go ahead. I am not enough an Emacs user to have... Could you read up the question as well? Yeah, yeah. Piotr asks, do you have mappings for Emacs?
19:02
And, my answer is I am not that much of an Emacs user to know it. However, the mappings, I mean, already if you tell me, Piotr, what is Emacs style interactive usage, it is no problem for me, even for me to come up with a few key mappings.
19:24
Because this is configurable, as you will also see in the using FIM presentation this afternoon, which is less nerdy than this one. And, when it comes to the language, the command line, I didn't say it,
19:40
or I didn't put much emphasis on this, but FIM uses auto-completion based on libredline. libredline is what you use in many shells and allows you to have auto-completion.
20:05
So, that has interactive auto-completion with Emacs style. However, that works under the frame buffer and not in X11. So, it's not exactly a solution, perhaps can be fixed.
20:25
Okay, I hope I answered the two aspects of Emacs style working with FIM. Please come up with another question, please.
20:52
So, could you say something about your motivation for writing FIM? Why did you want to take on this project?
21:02
Thanks, Arun. I wanted to be able to suit my very personal style of opening files or browsing files,
21:20
especially PDFs at the beginning. I liked to have PDFs and I wanted to use a style which is more VIM oriented. At the time, I didn't have a suitable alternative that I liked, mostly to suit my own needs, and it continues this way.
21:44
And also for the fun, these are the motivations behind FIM. Okay, yeah, that makes sense. So, you wanted a PDF reader and image reader that can be used with you. Yeah, when it comes to the PDFs, because I didn't speak here in this talk,
22:05
but there is a script which transforms images into, sorry, PDFs or similar files into PNGs. It's called FIM-GS and it's nothing else than the translation of FBI-GS
22:22
because FBI means to be an improvement of, FIM means to be an improvement of FBI, yeah. As opposed to just a script to convert? Exactly. It can also open CBZ or tarballs to extract stuff.
22:46
The extraction is not recursive, unfortunately. It's something that I wish to have at some point. Recursive extraction of tarballs or PDFs into images, or archives.
23:02
Archives also can be opened, by the way. Do we have any other questions? I don't see any. There seems to be a bit of lag in my question score box.
23:24
Yeah, but there are no questions. So, I'll ask one more. So, when you convert these PDFs to images for viewing in FIM, can you search through the PDF, I mean, search through the text of the PDF? No, no. The PDF will become an image and that's all.
23:45
I think in principle, yeah, by using Poplar, which is one library which FIM uses, might be possible in the future, but I don't plan this at the moment. For now, it's about images.
24:01
Use something else if you really need to use fully the F functionality. For now, stick to FIM for images. People use FIM for image frames. Good for them, but I think it's a bit not using FIM at the full potential. I think FIM should be used interactively for images.
24:24
And when one wants to have some special custom command, then you are welcome to configure FIM. But mostly, it's meant for interactive usage. So, don't take me wrong here. It's not something for programming stuff. Use a library for that. This is just for viewing and viewing on steroids, hopefully.
24:43
Yeah. So, what do you mean by image frames? You said something about image frames. I mean, small devices, which usually have a small screen, a very weak processor, which every five minutes, perhaps, changes an image and does a slideshow which is very low.
25:01
Oh, okay. But it's usually not interactive. I think people use it a lot for this and for the last Bell API, for instance, because I think there is no X there. Or, let's say, it's good to use the frame buffer there. But I encourage using FIM interactively every day,
25:22
if you like this style of keyboard-oriented usage, of course. I wish to have menus and I'm working on that, but that's not the spirit of FIM. Okay, I think the time is over. We still have two and a half minutes. I mean, two hours, 45 seconds.
25:43
Sorry, two minutes, 45 seconds. I still don't see more questions. It's probably a bit early in the morning. Yes.
26:21
I asked the question about the PDFs because Emacs has something very similar to look at PDFs and it has the same problem with search. It converts the PDFs to images and then, yeah, you can't really do much with the image. It's not a substitute for a PDF video. That's the point, yeah.
26:47
Can you play SVG images using FIM? Sorry, can you repeat, please? Can you handle SVG images in FIM? Which images? Yeah, SVG, Scalable Vector Graphics.
27:01
Yes, yes, yes. Okay. Yeah, there is an internal conversion which uses Inkscape to produce, to render an internally pixel map out of the SVG. So you have different converters inside FIM. Sorry, not inside, being invoked by FIM
27:24
to make out of even your custom format a pixel map. So I invite who wish to use this FIM this afternoon, my other talk. I think it's at 3.30 or something like this. It will be most about usage.
27:42
So, yeah. I think, guys, you should prepare for the next recording. The next talk, I think someone else will be handling. Yeah. Good. So we are almost done.
28:01
Thanks, Arun. Yeah, if you want to add something, you have 20 seconds more. Now, welcome to follow me live in Brussels this afternoon. Who is in Brussels or otherwise, virtually? Thanks, Arun. Thanks to organizer Manolis and Piotr. Yeah, thank you, Mr.
28:22
Ciao. Bye.