ansible-koji/docs/technical/reference/svg_conversion.rst
Rénich Bon Ćirić 89d6f66be8
feat: Integración de Siguldry PKCS#11 y spooler de firmas
* Implementación del rol de Ansible 'siguldry' para CentOS Stream 10
* Migración del plugin de firmas de Koji Hub a un spooler asíncrono
* Modificación de roles para utilizar empaquetamiento RPM nativo de siguldry-pkcs11
* Documentación de decisiones (ADRs) y roadmap en docs/technical/
* Limpieza de binarios locales pesados de PKCS#11 en Ansible

Co-developed-by: Gemini AI <renich+gemini@woralelandia.com>
Signed-off-by: Rénich Bon Ćirić <renich@woralelandia.com>
2026-06-16 10:06:44 -06:00

105 lines
3.5 KiB
ReStructuredText

==================================
SVG to PNG Conversion on EL10/CS10
==================================
Context and Tooling Selection
-----------------------------
Personalizing Koji Web branding for MxOS requires converting corporate vector assets (specifically ``mxos.svg`` and ``mxos-reducido.svg``) into high-resolution PNG format (e.g. to be placed in ``images/koji.png`` within the custom theme).
Because enterprise servers require lightweight and reliable packages, CentOS Stream 10 (EL10) / RHEL 10 AppStream repositories provide native utilities for graphic conversion. Additional modern utilities can be pulled from EPEL 10 or installed via the Python ecosystem.
Conversion Tools and Usage
--------------------------
Three primary methods are available on CentOS Stream 10 to perform SVG to PNG conversion:
rsvg-convert (librsvg2-tools)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the recommended, native tool for server environments. It is extremely lightweight, fast, and does not require a graphical display server (X11/Wayland).
* **Package installation**:
.. code-block:: bash
sudo dnf install librsvg2-tools
* **Command usage**:
To perform a simple conversion, use the output flag (``-o``):
.. code-block:: bash
rsvg-convert -o koji.png mxos.svg
* **Sizing and aspect ratio preservation**:
Specify target dimensions directly. Use the ``--keep-aspect-ratio`` flag to prevent stretching:
.. code-block:: bash
rsvg-convert -w 250 --keep-aspect-ratio -o koji.png mxos.svg
Inkscape CLI
~~~~~~~~~~~~
Inkscape is a powerful editor, but is heavier than ``rsvg-convert``. It is useful if complex SVG features (like certain embedded filters or text styling) do not render correctly in ``rsvg-convert``.
* **Package installation**:
Depending on EPEL 10 availability, install via DNF or use Flatpak as an isolated container:
.. code-block:: bash
sudo dnf install inkscape
* **Command usage**:
The modern Inkscape command-line structure uses the ``-o`` flag:
.. code-block:: bash
inkscape -o koji.png mxos.svg
* **Sizing**:
Resize the export using the ``-w`` (width) or ``-h`` (height) options:
.. code-block:: bash
inkscape -w 250 -o koji.png mxos.svg
CairoSVG (Python Library)
~~~~~~~~~~~~~~~~~~~~~~~~~
CairoSVG is a Python-based SVG-to-PDF/PNG converter. It is not packaged as a native RPM in base EL10 repositories, but is useful for scripted configurations.
* **Installation**:
Install using Python's package manager within a virtual environment or on the user-level path:
.. code-block:: bash
pip3 install --user cairosvg
* **Command usage**:
.. code-block:: bash
cairosvg mxos.svg -o koji.png
* **Python Code integration**:
.. code-block:: python
import cairosvg
cairosvg.svg2png(url='mxos.svg', write_to='koji.png', output_width=250)
Application for Koji Web Branding
---------------------------------
To personalize the Koji Web theme for MxOS:
1. Convert the logo vector to the required logo size (standard Koji logos are usually around 100-250px wide):
.. code-block:: bash
rsvg-convert -w 250 --keep-aspect-ratio -o koji.png mxos.svg
rsvg-convert -w 64 --keep-aspect-ratio -o koji-reducido.png mxos-reducido.svg
2. Copy the resulting PNG assets into the custom Koji Web static theme directory (e.g. ``/usr/share/koji-web/static/themes/mxos/images/koji.png``).