Giter Site home page Giter Site logo

imagecli's People

Contributors

clbarnes avatar hbina avatar theotherphil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagecli's Issues

[FEATURE SUGGESTION] `MAP` a command onto each image on the stack

MAP is essentially shorthand for the array syntax, except each command in the array is the same, and the array is the length of the stack.

i.e.

[gaussian 2.0, gaussian 2.0]

for a stack of size 2 becomes

MAP gaussian 2.0

I recognize that you could also probably do some funky stuff with functions/index of the image on the stack/etc. but just this seems good enough to me.

use crop command occur error

imagecli -i test.png -o Crop_0_0.png -p 'crop 10 50 100 150'
thread 'main' panicked at '
Unable to parse pipeline.

Consumed: ''
Remaining: 'crop 10 50 100 150'

The error is likely near the start of the remaining (unparsed) text.
', D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\imagecli-0.1.0\src\image_ops.rs:45:13
stack backtrace:
0: 0x7ff6a2a5c489 -
1: 0x7ff6a2a745db -
2: 0x7ff6a2a58a04 -
3: 0x7ff6a2a5ef60 -
4: 0x7ff6a2a5eb8a -
5: 0x7ff6a2a5f7b8 -
6: 0x7ff6a2a5f324 -
7: 0x7ff6a2a5f26f -
8: 0x7ff6a2958492 -
9: 0x7ff6a29299df -
10: 0x7ff6a292918d -
11: 0x7ff6a28b4380 -
12: 0x7ff6a28b2490 -
13: 0x7ff6a2a5f167 -
14: 0x7ff6a2a63b02 -
15: 0x7ff6a2a5fae2 -
16: 0x7ff6a28b49a7 -
17: 0x7ff6a2a79249 -
18: 0x7fff78997974 - BaseThreadInitThunk
19: 0x7fff7aa0a271 - RtlUserThreadStart

Add "Image" and "CLI" tags to GitHub repo

Hey there, I keep trying to find this repo by searching "image CLI" on GitHub and not being able to find it because it is one word in the github repo. It would help a lot to add the "image" and "cli" tags to the repo I think.

Create regression tests from examples

We already run all examples when generating the readme. Add a regression test that runs all of the examples.

Edit: and update CONTRIBUTING.md when this is done.

Ability to do the same operations on multiple images in parallel?

For example, lets say it is known that a given pipeline requires 2 input images and 3 output images and the user provides a total of 20 images, it should be possible to split this into 10 different operations right? Thus producing a total of 30 images.

This should be possible to implement because each image operations already have the signature method that tells how many images goes in and out of it (if possible).

The total output is easy, it should simply be however many images the final step generates.
The total input is a bit tricky because each step may generates additional images, so it needs to take these into account as well.
But I think I have an algorithm that should be able to determine this, but I have no idea if its "correct".

The algorithm to determines the total input images required for a given sequence of image operations is as follows (assuming each of these signatures return Some(_).

Given [(a1,b1), (a2, b2), (a3, b3), ...] where each tuple is the signature of each operations.
First, calculate how much extra images each step requires from the previous step.

For the 1st operation, it requires exactly a1 images i.e. a1 - 0.
The 2nd operations requires a2 images but the 1st step provides b1 images, so it only needs a2 - b1 images.
So on and so forth.

So we have something like,

[a1 - 0, a2 - b1, a3 - b2, ...]

Finally, the total input images required for this pipeline is just the sum of this array.

This will be a breaking change, so I am thinking of an additional flag like --parallel or something.

Some examples:

  1. [(3, 2), (2, 3)] => (3, 3)
  2. [(3, 2), (2, 2), (2, 3)] => (3, 3)
  3. [(2, 3), (8, 1)] => (7, 3)
  4. [(2, 8), (3, 1)] => (-3, 3) <== special case needed ....

Feature request: Add tile operation

-p 'tile <width_px> <height_px>' would add to the stack, in row-major order, the given image split into tiles of that size.

Implementation

Basically just a bunch of crops: if the image size is not tile-aligned, fill the remainder of that tile with black.

Problems

Specifying the tile dimensions means you have to know the image's dimensions to predict how many outputs you will get, which is probably not desirable. A shorter route to some sort of tiling function would be to specify how many tiles you want in x and y: if the caller wants tiles of a certain size, they will have to fill out the main image to something tile-aligned and divide it as appropriate. Then you'd also have to deal with subpixels.

Cannot Resize _Without_ Preserving Aspect Ratio

Hey there!

I'm trying to resize my image to a perfect square using the following command, but no matter what I do, it always comes out in the original aspect ratio, instead of squishing or stretching it to make it a square in the dimensions I have provided:

imagecli -i source/$file -o resized/$file -p 'resize 100 100'

Ironically I switched to trying to use imagecli for this exact task after not being able to figure out how to do the same thing in ImageMagik!

Fix out of date claim in docs

β€œThere aren't currently any image processing operations that produce multiple outputs from a single input.”

This is no longer true - the tile operation splits a single input into multiple outputs.

Improve support for user-provided functions

Add ability to call a limited set of standard functions, e.g. min, max, sin.

Add support for defining functions on pixels rather than just sub pixels. For example, it should be possible to write a function that rotates the red, green and blue channels in an RGB image. (rgb(p.1, p.2, p.0) ?)

Show aliases in documentation

hcat, vcat and SWAP do not currently have their own top-level documentation - they just get a mention inside the documentation for grid and ROT.

Extend Documentation to include an aliases section, and pull aliases out into top-level items when generating the README.

Add more drawing functions

There's currently only Circle, and it's pretty clunky to use. Work out a sensible convention for calling drawing functions and add support for lines, rects, etc.

Improve error messages

e.g. explain which files couldn't be opened or found rather than just "No such file or directory".

Add glob support for finding inputs

And work out how to handle output names when doing this. Would also need an easy way of determining whether a pipeline should be run on all the images at once, or once per input. One possibility is to always include all input images in the stack and add a MAP operator that applies a function to everything in the stack. Multi-input operations, and multi-stage pipelines both make this slightly more complicated, but should work ok - MAP should walk the stack taking as many inputs as it needs at each point, and then for example you can run MAP DUP > MAP hcat.

[Feature] Normalize

Hey there, very cool tool. πŸ˜ƒ πŸ‘ A feature I use from imagemagic that imagecli doesn't have yet is the normalize command. I use it to get the best contrast out of my printer scans without having to even open an image editor or tweak any settings.

Nested pipelines

Some things are currently a bit of a pain to do using a stack.

An example that we should be able to make simpler: create a 2x2 grid with contents:

Top-left: original. Top-right: hflip-ed original. Bottom-left: vflip-ed original. Bottom-right: vflip-ed hflip-ed original.

One possibility is to add a Pipeline (Sequence?) image operation. We could then write the example as DUP 3 > [id, hflip, vflip, hflip > vflip]. The nesting of array and pipelines could get a bit gnarly, but it should be conceptually simple, and fairly easy to use in practise.

Change const behaviour

It currently consumes an image before writing the constant output. Support just pushing a new image instead. (This means it won't work with map. Does that matter?)

Consider adding a static pipeline arity check

We know how many inputs and outputs each operation has before we run the pipeline (although we need to compute this for an Array). Should we add checks that the given pipeline won't try to read from an empty stack, that each input is used, and that all outputs have a corresponding output path?

Even if we don't add the check, we could add num_outputs to the ImageOp trait instead of returning it from the apply method.

Treating all inputs as globs leads to confusing behaviour

-i robin.pg (note typo) results in no images being found and an error about not having enough images on the stack for the first operation in the pipeline. Before treating all inputs as globs this would have resulted in an error message about not being able to open the non-existent image.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.