publiclab / image-sequencer

A pure JavaScript sequential image processing system, inspired by storyboards

Home Page:https://sequencer.publiclab.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detect and parse any input syntax type (string, obj) in addSteps, replaceImage methods

jywarren opened this issue · comments

I noticed that sequencer.addSteps('invert,ndvi') doesn't work because it doesn't recognize and parse the string. We should detect commas and pre-filter the input using sequencer.importString() so that we can simply pass multiple steps in via addSteps()

This shouldn't be too hard, and we can add this as an example to the README too, where actually we don't show the use of string syntax -- we can demonstrate in a new subsection:


Use string syntax (see below) to add multiple steps and configurations quickly by passing a string to `sequencer.addStep()`:

...example...

This'd be a really nice refinement!

Just a note that:

  1. addSteps() and insertSteps() share an implementation, so we'd best make this improvement work for both.
  2. any of the input types listed in https://github.com/publiclab/image-sequencer#string-syntax ought to still return the sequencer object itself, so that the methods can be chained, like sequencer.addSteps().run()

Thanks!

And actually we should check that there's a test for their chainability -- i think there is, if I remember right!

Hmm. Working on this!

Ah, actually maybe what we should say is that any of the following methods should accept full range of input syntaxes, including string, object:

  • addStep
  • insertStep
  • replaceImage

any others? We could have a method called detectSyntax() and one called parseSyntaxes() maybe to make this easy to add anywhere?

I just linked to this from publiclab/leaflet-tile-filter#3 because once this is complete we should be able to vastly improve that use case! Thanks @VibhorCodecianGupta !