Question

I am looking for an advice how to resize an image using libpng in C. I have already written a function, which makes png image from the structure. I want to make my image bigger: for example 1 pixel is extended to 9 pixels (3x3). Is there any function which would be able to do that?

Was it helpful?

Solution

No, libpng is an I/O library that deals with reading and writing the PNG image format.

Resizing an image has nothing to do with any on-disk file format, it's a pure image operation that generally happens in-memory.

You should look at some general-purpose image-processing library, or just do it yourself. The particular resize you mention is easy enough, just read a single pixel and write it 9 times to the output. Then use libpng's functions to save the new image.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top