Lisandro has written some code in PETSc that writes such files. He has written it as a way to save images from PETSc graphics to files but it may be possible to extend and use for your purposes without too much difficulty.
The code is in src/sys/classes/draw/utils/image.c If you add, for example, reading such files and other processing we would be very happy to accept it in a pull request. Barry > On Oct 14, 2016, at 9:20 AM, Laurent Hoeltgen <hoelt...@b-tu.de> wrote: > > Hi all, > > does petsc provide some functionality to read images files (png, pgm, jpg, > ...) and also to write such files? I’d like to do some low level image > processing tasks where I need direct access to the pixel values. So anything > that gives me a vector or matrix with this data would be perfect. > > Best regards, > Laurent > > % ------------------------------------------------------------- % > Dr. Laurent Hoeltgen > > Chair for Applied Mathematics > Brandenburg University of Technology > Platz der Deutschen Einheit 1, HG 3.26 > 03046 Cottbus, Germany > > Email: hoelt...@b-tu.de > Web. http://www-user.tu-cottbus.de/~hoeltgen/ > Tel. +49 (0) 355 69 20 77 > Fax. +49 (0) 355 69 27 10 > % ------------------------------------------------------------- % > >