From c9a47b2e828d627312a75d901bf8c77f9255b491 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 23 Oct 2021 21:55:32 -0400 Subject: [PATCH] Use svgstat instead of magick for svg file analysis --- docker/app/Dockerfile | 1 + lib/philomena/analyzers/svg.ex | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 361fc39e..e5deb30e 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -12,6 +12,7 @@ RUN git clone https://github.com/philomena-dev/cli_intensities /tmp/cli_intensit ADD https://api.github.com/repos/philomena-dev/mediatools/git/refs/heads/master /tmp/mediatools_version.json RUN git clone https://github.com/philomena-dev/mediatools /tmp/mediatools \ + && ln -s /usr/lib/librsvg-2.so.2 /usr/lib/librsvg-2.so \ && cd /tmp/mediatools \ && make -j$(nproc) install diff --git a/lib/philomena/analyzers/svg.ex b/lib/philomena/analyzers/svg.ex index 8eae2373..d76aab4b 100644 --- a/lib/philomena/analyzers/svg.ex +++ b/lib/philomena/analyzers/svg.ex @@ -12,9 +12,9 @@ defmodule Philomena.Analyzers.Svg do end defp stats(file) do - case System.cmd("identify", ["-format", "%W %H\n", file]) do + case System.cmd("svgstat", [file]) do {output, 0} -> - [width, height] = + [_size, _frames, width, height, _num, _den] = output |> String.trim() |> String.split(" ")