简体   繁体   English

libpng:写出大于1002px的png

[英]libpng: write a bigger png than 1002px

I'm currently writing a c++ program which should write me a png file as output. 我目前正在编写一个c ++程序,该程序应该将png文件写为输出。 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. 但是:仅当宽度不超过1002像素时,它才有效。 I am very sure the problem is somewhere around lines 29/30, so a malloc problem, but I don't get it. 我非常确定问题出在29/30行附近,所以是malloc问题,但我不明白。

Thanks for your help & greez 感谢您的帮助和问候

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? 您是否尝试增加此值?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM