Erlang module for PNG images

I need to create images in PNG format - is there a recommended Erlang module to do that with? Create image, set individual pixels, save to disk.

ChatGPT recommends largerpng - but that seems to be a hallucination…

Add lagerpng as a dependency in your Erlang project. You can include it in your rebar.config or mix.exs file, depending on whether you’re using Rebar3 or Mix as your build tool. Here’s an example for Rebar3:

erlangCopy code

{deps, [
  {lagerpng, "1.0.0"}
]}.

Have you had a look at: https://hex.pm/packages/png
First pure erlang result on hem

1 Like

eimp maybe? Haven’t used it yet so I can’t tell if that’s what you’re looking for, but that came OTOH.

1 Like

The built-in wx package allows reading and writing PNG images (and more formats) and accessing the individual pixels

1 Like

Thanks - there is another “built-in” package that I also tried to use - until I realised it was no longer part of OTP. I ended up writing my own version - wouldn’t want to do that for every image format out there, but turns out PNG is relatively simple - and Erlang with its binary support not a bad implementation language.

2 Likes

I have one here as well: https://github.com/dgud/wings/blob/master/e3d/e3d__png.erl

3 Likes

I did my own implementation some time ago as well. Turned out to be quite easy

But png package from HEX looks interesting as well. I wonder why I did not use it back then…

1 Like