a1337q
a1337q

Reputation: 780

libpng: write a bigger png than 1002px

I'm currently writing a c++ program which should write me a png file as output. So I made a little code, actually works. I just took the source code from here and condesed it. My code is nopasted here.

BUT: It only works if it doesn't exceed 1002 pixels in width. I am very sure the problem is somewhere around lines 29/30, so a malloc problem, but I don't get it.

Thanks for your help & greez

Upvotes: 0

Views: 263

Answers (1)

Starkey
Starkey

Reputation: 9781

Without diving into the code too deeply, there are these interesting constants:

unsigned width = 1003;
unsigned height = 500;
int rowbytes = 4000;

The last one directly controls the amount of memory allocated. Have you tried increasing this value?

Upvotes: 1

Related Questions