I’m excited to announce the release of hvif-tools, a small set of command-line utilities designed to work with the Haiku Vector Icon Format (HVIF). This project provides two main tools: hvif2svg and svg2hvif, enabling conversion between these two important formats.
A key goal of this project is cross-platform compatibility. These tools are designed to be compiled and run effectively on Linux, macOS, Windows, and of course, Haiku.
Features:
hvif2svg
Parses .hvif files, including header validation.
Renders paths (points, curves), shapes, and styles (including solid colors and gradients).
Supports fills and strokes (utilizing HVIF’s STROKE/CONTOUR transformers).
Handles linear and radial gradients, including gradientTransform attributes and correct stop opacity.
Operates within HVIF’s native coordinate system (viewBox 0 0 6528 6528, equivalent to 64 × 102 units).
svg2hvif
Parses SVG files using the lightweight, header-only NanoSVG library.
Normalizes SVG coordinates to fit HVIF’s 64x64 unit space and centers the content.
Converts SVG fill and stroke properties, including line caps, joins, miter limits, stroke widths, and opacity.
Supports conversion of linear and radial gradients.
Availability:
Haiku: Ready-to-use package are available now in HaikuDepot.
Linux / macOS / Other: The source code is available on GitHub, allowing you to build the tools on any system with a compatible C/C++ compiler.
Future Development: Native Haiku GUI Application
In addition to these command-line tools, I’m also actively developing a native graphical application for Haiku. This application aims to provide a user-friendly interface for working with icons:
Open and view SVG icons.
Open HVIF icons, read them directly from application attributes, and automatically convert them to SVG for viewing.
Convert opened SVG/HVIF files and allow drag-and-drop onto application/file types/mime types for easy integration.
Automatically generate rdef arrays and C++ arrays suitable for embedding directly into applications.
The GUI application is still under development. You can see some progress in the screenshots below:
Much appreciated!
Can you explain why you decided to code these dedicated cli apps and not extend the existing HVIF and SVG translators to be able to output not just bitmaps, but SVG and HVIF respectively?
The main idea was to make them cross-platform. So that conversion could be done not only for Haiku. It will be quite easy to write translators based on ready-made classes, if someone wants - there is a very simple and convenient API.
A new version of the hvif2svg and svg2hvif conversion utilities, including import and export modules for Inkscape, is already available in HaikuDepot. I also made sure that when Inkscape is installed, they are installed automatically by dependencies.
I don’t quite understand what you mean. Let’s say I’m creating translators from svg to hvif and back, but what software do we have that will use them? Moreover, it was not for nothing that I wrote in the topic that these are cross-platform utilities that will work on any systems. You can compile this project for Linux or Windows without any problems and use them in Inkscape. I have already tested editing hvif files in Inkscape for windows and everything works fine.
There has been some progress with the img2svg utility for vectorizing bitmap images into vector images, as well as a native application for working with SVG/HVIF files and using the same vectorizer: