libpng: write a bigger png than 1002px

落爺英雄遲暮 提交于 2019-12-24 19:06:10

问题


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


回答1:


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?



来源:https://stackoverflow.com/questions/3686265/libpng-write-a-bigger-png-than-1002px

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!