title: How to convert erlang module (wxImage) const/array to a list in Elixir?
body: <p>I am trying to manipulate a "test.jpg" image in Elixir by using Erlang wxImage library, but I am getting an error. I do not know how to convert the array/const output to a list so I can use it in Elixir.</p>
  
  <p>Also I do not know why there is a clause function error when the syntax seems to be alright?</p>
  
  <pre><code>defmodule Imedit2 do
    def readimg(image) do
      {:ok, _file} = File.open("happy737.txt", [:write])
      IO.puts("hi there")
      _output =
        image
        |&gt; File.read!()
        |&gt; :wxImage.getData()
        |&gt; to_charlist()
  
      # IO.puts(is_list(output))
      # IO.puts(is_tuple(output))
      # IO.binwrite(file, output)
      # File.close(file)
    end
  end
  </code></pre>
  
  <pre><code>iex(58)&gt; Imedit2.readimg("test.jpg")
  hi there
  ** (FunctionClauseError) no function clause matching in :wxImage.getData/1
  
  The following arguments were given to :wxImage.getData/1:
  
      # 1
      &lt;&lt;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, 0, 25, ...&gt;&gt;
  
  gen/wxImage.erl:405: :wxImage.getData/1
  lib/imedit2.ex:5: Imedit2.readimg/1
  </code></pre>