New image processing library: Zignal

Hi everyone!

Zignal 0.10.0 is out. compilable with Zig 0.16.0.

There are the usual performance improvements and bug fixes, but the main highlight is a simple CLI tool to perform various image operations via the terminal.

You can get an idea of what it can do with:

Usage: zignal [options] <command> [command-options]

Global Options:
  --log-level <level>   Set the logging level (err, warn, info, debug)

Commands:
  blur     Apply various blur effects to images.
  diff     Compute the visual difference between two images.
  display  Display an image in the terminal using supported graphics protocols.
  edges    Perform edge detection on an image using Sobel, Canny, or Shen-Castan algorithms.
  fdm      Apply Feature Distribution Matching (style transfer) from target to source image.
  info     Display detailed information about one or more image files.
  metrics  Compute quality metrics (PSNR, SSIM, Mean Error) between a reference and target images.
  resize   Resize an image using various interpolation methods.
  tile     Combine multiple images into a single tiled image.
  version  Display version information.
  help     Display this help message

Run 'zignal help <command>' for more information on a specific command.

For example:

zignal help display

Usage: zignal display <image> [options]

Display an image in the terminal using supported graphics protocols.

Options:
  --width <N>     Target width in pixels
  --height <N>    Target height in pixels
  --protocol <p>  Force protocol: kitty, sixel, sgr, braille, auto

Full release notes here:

6 Likes

I think the ‘railroad’ like you’re doing here is as good as it gets for chaining in Zig. And it’s pretty good!

Maybe not worth changing, but I find eval confusing as the name of the finalizer. It makes me think that all the calls before are setting up an operation, and only the final one does it. But it looks like that isn’t how it works.

I would use ok() here for that reason. That I would read right away as “oh, right, the try, railroad pattern”. If you’re past the point where tweaking the API for surface reasons like that feels worth doing, that’s understandable.

It’s been neat seeing this project grow, good work.

Hi! Thank for your encouraging words.
You’re right, .eval() is misleading, since the user might think there’s some kind of lazy evaluation or something…
I need to find a better name and .ok() might be it. I don’t mind breaking the API, it’s explicitly stated in the README. And I don’t think people are using Zig expect a smooth developer experience, once you choose to use Zig, you assume things will break :stuck_out_tongue:
I will think more about it. Thanks again :slight_smile:

2 Likes