Support PNG previews to preserve alpha channels

This commit is contained in:
Mark Felder 2020-08-30 09:17:24 -05:00
commit 2d2af75777
2 changed files with 47 additions and 2 deletions

View file

@ -23,6 +23,23 @@ defmodule Pleroma.Helpers.MediaHelper do
end
end
defp prepare_image_resize_args(
%{max_width: max_width, max_height: max_height, format: "png"} = options
) do
quality = options[:quality] || 85
resize = Enum.join([max_width, "x", max_height, ">"])
args = [
"-resize",
resize,
"-quality",
to_string(quality),
"png:-"
]
{:ok, args}
end
defp prepare_image_resize_args(%{max_width: max_width, max_height: max_height} = options) do
quality = options[:quality] || 85
resize = Enum.join([max_width, "x", max_height, ">"])