Hi Everyone, your help is appreciated. I am trying to do image manipulation on a test.jpg file by calling the erlang module wxImage.getData()
defmodule Imedit2 do
def readimg(image) do
{:ok, _file} = File.open("happy737.txt", [:write])
IO.puts("hi there")
output = File.read(image) |> :wxImage.getData()
# is_list(output)
IO.puts(is_tuple(output))
# IO.binwrite(file, output)
# File.close(file)
end
end
The erlang documentation tells me that the return from that function is an array of RGB values. I have tried to check if the returned output is automatically converted to tuple or list in my code but it’s not working, since I am actually getting this error before I have the change to get is_tuple or is_list
** (FunctionClauseError) no function clause matching in :wxImage.getData/1
The following arguments were given to :wxImage.getData/1:
# 1
{:ok,
<<255, 216, 255, 226, 2, 28, 73, 67, 67, 95, 80, 82, 79, 70, 73, 76, 69, 0, 1,
1, 0, 0, 2, 12, 108, 99, 109, 115, 2, 16, 0, 0, 109, 110, 116, 114, 82, 71,
66, 32, 88, 89, 90, 32, 7, 220, 0, 1, ...>>}
gen/wxImage.erl:405: :wxImage.getData/1
lib/imedit2.ex:5: Imedit2.readimg/1
I have DuckDuckGo-ed this error and found many replies that it’s syntax related. However, VS Code is telling me the syntax is correct.