summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLain Soykaf <lain@lain.com>2023-11-28 12:23:41 +0400
committerLain Soykaf <lain@lain.com>2023-11-28 12:23:41 +0400
commit03db495e1d88f34bef8d556b0f88806c3260d403 (patch)
tree22057cc3651ea7069f2b1777d35a1187436a0691 /lib
parent299c548b124377e51f6c089bc0df31b2989be3ef (diff)
downloadpleroma-03db495e1d88f34bef8d556b0f88806c3260d403.tar.gz
pleroma-03db495e1d88f34bef8d556b0f88806c3260d403.zip
AnalyzeMetadata: Switch to rinpatch_blurhash
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/upload/filter/analyze_metadata.ex14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/pleroma/upload/filter/analyze_metadata.ex b/lib/pleroma/upload/filter/analyze_metadata.ex
index 92b80b1b1..710fd02d2 100644
--- a/lib/pleroma/upload/filter/analyze_metadata.ex
+++ b/lib/pleroma/upload/filter/analyze_metadata.ex
@@ -87,17 +87,17 @@ defmodule Pleroma.Upload.Filter.AnalyzeMetadata do
{height, width} <- {Image.height(resized_image), Image.width(resized_image)},
max <- max(height, width),
{x, y} <- {max(round(width * 5 / max), 1), max(round(height * 5 / max), 1)} do
- {:ok, rgba} =
+ {:ok, rgb} =
if Image.has_alpha?(resized_image) do
- Image.to_list(resized_image)
+ # remove alpha channel
+ resized_image
+ |> Operation.extract_band!(0, n: 3)
+ |> Image.write_to_binary()
else
- Operation.bandjoin_const!(resized_image, [255])
- |> Image.to_list()
+ Image.write_to_binary(resized_image)
end
- rgba = List.flatten(rgba)
-
- Blurhash.encode(x, y, width, height, rgba)
+ Blurhash.encode(rgb, width, height, x, y)
else
_ -> nil
end