我编写了一个程序来处理由单独进程生成的一堆 png 文件。捕获大多有效,但有时进程会终止并重新启动,从而留下损坏的图像。我无法检测进程何时终止或它终止了哪个文件(大约有 3000 个 png 文件)。
有没有检查损坏的 png 文件的好方法?
OS: Win7, using MinGW, sh.exe from MSYS
./configure --prefix=/mingw
Run Code Online (Sandbox Code Playgroud)
with and without prefix ends like this:
checking for zlibVersion in -lz... no
checking for yeszlibVersion in -lz... no
configure: error: zlib not installed
Run Code Online (Sandbox Code Playgroud)
i've installed zlib through cmake, it went smoothly and without errors, so i have all zlib files in my bin, lib and include folders
what can be the problem? how do i fix this?
UPD
looks like it's because i have libzlib.dll and not libz.dll in bin …
我在C中使用libpng编写了一个小实用程序.在linux下,我只需安装libpng-dev并执行"gcc myapp.c /usr/lib/libpng.so -o myapp".在Mac OS X中,我安装了Xcode工具,我相信它包含了libpng.我链接了什么,是否需要为png.h指定包含路径?
我正在尝试为Windows Mobile 6编译libpng,但是我得到以下链接器错误:
error LNK2019: unresolved external symbol __imp___iob_func referenced in function png_default_error libpng.lib
error LNK2019: unresolved external symbol __imp_abort referenced in function png_longjmp
Run Code Online (Sandbox Code Playgroud)
使用/ MD选项完成编译,我的主项目之间相同.zlib和libpng.
当使用/ MT时,仍然存在错误,但略有不同:
error LNK2019: unresolved external symbol __iob_func referenced in function png_default_error
error LNK2019: unresolved external symbol abort referenced in function png_longjmp
Run Code Online (Sandbox Code Playgroud)
这带来了几个问题.
__imp___iob_func和__imp_abort?我的libpng编译器选项:
/Od /I "..\lib\zlib-1.2.7" /I "..\lib\lpng1512" /D "_DEBUG" /D "_WIN32_WCE=0x502" /D "UNDER_CE" /D "WIN32_PLATFORM_PSPC" /D "WINCE" /D "DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBPNG_EXPORTS" /D …Run Code Online (Sandbox Code Playgroud) 我的平台:
Centos 6.X,Matplotlib-1.3.1,Numpy-1.8.0,Scipy 0.14.0.dev-bb608ba
我正在尝试安装libpng-1.6.6来显示.png文件但是在尝试make它时未能给出以下错误.
注意:我已成功预安装zlib(以及freetype2),这应该是错误所指向的.
pngfix.o: In function `zlib_reset':
/usr/lib/hue/libpng-1.6.6/contrib/tools/pngfix.c:2151: undefined reference to `inflateReset2'
collect2: ld returned 1 exit status
make[1]: *** [pngfix] Error 1
make[1]: Leaving directory `/usr/lib/hue/libpng-1.6.6'
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)
请参阅我的原始线程matplotlib-pyplot-does-not-show-output-no-error的链接
我检查了2151行的pngfix.c.它是zlib_reset函数,与rc设置有关.是否指向更改一些matplotlibrc设置?
2136 zlib_reset(struct zlib *zlib, int window_bits)
2137 /* Reinitializes a zlib with a different window_bits */
2138 {
2139 assert(zlib->state >= 0); /* initialized by zlib_init */
2140
2141 zlib->z.next_in = Z_NULL;
2142 zlib->z.avail_in = 0;
2143 zlib->z.next_out = Z_NULL; …Run Code Online (Sandbox Code Playgroud) import pygame对我来说工作正常,但import pygame.font失败并出现错误:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/font.so, 2): Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/lib/libfreetype.6.dylib
Reason: Incompatible library version: libfreetype.6.dylib requires version 30.0.0 or later, but libpng15.15.dylib provides version 20.0.0
这是在Python 2.7(不是系统版本),Mac OS 10.9中.我在libfreetype想要更高版本的想法上安装了libpng-1.6.9,但这似乎没有帮助.
我升级了包并破坏了我的matplotlib安装.现在,当我运行时import matplotlib.pyplot as plt,我收到以下错误:
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/matplotlib/ft2font.so, 2):
Library not loaded: /usr/local/lib/libpng16.16.dylib
Referenced from: /usr/local/lib/libfreetype.6.dylib
Reason: image not found
Run Code Online (Sandbox Code Playgroud)
为了解决这个问题,我卸载了freetype和libpng brew.具体来说,我使用brew uninstall freetype && brew cleanup && brew install freetype和相同的命令libpng.我重新安装了matplotlib(pip uninstall matplotlib,然后pip install matplotlib).
这没有解决它,我不知道下一步是什么能够有一个有效的matplotlib(.pyplot)安装.
简介:我需要一个PNG编写器,由于各种原因,我必须从头开始.我不需要压缩图像数据,因此我使用无压缩deflate算法实现了PNG.对于需要多个放气块的图像,渲染失败,似乎是因为它忽略了块长度.
问题:当我使用单个放气块写入一个小图像时,生成的图像正是它应该是的(所有像素都正确,使用pngcheck检查时没有错误).但是,一旦我使用多个deflate块,结果图像就会出错,因为正在读取deflate块超过它们的长度(尽管pngcheck仍然没有显示错误).在十六进制编辑器中查看原始数据似乎表明一切都符合规范(根据libpng,RFC 1950和RFC 1951).
实施例的数据:我生成一个3×1 RGBA图像在像素的颜色是,从左到右,(fb,02,03,fa),(01,fc,03,fa),(01,02,fd,fa).然后我将它们写入文件,最大压缩块长度为8字节或64字节.64字节块长度图像完全正确并正确呈现.
完整的图像内容如下所示,其中粗体是块长度,斜体是块数据.
8字节块图像(渲染不正确):
89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 03 00 00 00 01 08 06 00 00 00 1b e0 14 b4 00 00 00 1d 49 44 41 54 78 9c 0000 08 ff f700 fb 02 03 fa 01 fc 03 0100 …
我正在使用imagemagick,据我所知,它将png文件处理委托给libpng库,所以我想知道如何检查libpng使用的是什么版本?
我想读取png文件,请参阅图像数据并再次写入,文件大小没有任何变化.基于libpng文档,png是无损的,使用deflate和lz77进行压缩.在libpng中有一个示例项目声称可以无损地读写图像,它在像素值方面是正确的,但是改变文件的结构(例如IDAT的数量,可选的块等)png文件大小.
我的明确问题:如何从压缩流(libpng中的Zstream)中提取编码参数(例如deflate params或lz77 params)并使用此参数对原始图像进行编码以创建与输入文件相同的图像文件而不进行任何更改?
这是我的代码.我试着在info_ptr中保持params 来写图像,但不能正常工作.怎么做?
int main(int argc, char *argv[])
{
inname = argv[1];
outname = argv[2];
png_structrp read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_infop info_ptr = png_create_info_struct(read_ptr);
if (!info_ptr)
{
png_destroy_read_struct(&read_ptr, (png_infopp)NULL, (png_infopp)NULL);
}
png_FILE_p imageFile, imageFile2, imageFileW;
imageFile=fopen(inname, "rb"); imageFileW = fopen(outname, "wb"); imageFile2 = fopen(inname, "rb");
int fileSize=fsize(imageFile2);
unsigned char* bufImWrite = malloc(sizeof(char)*fileSize);
fread(bufImWrite, 1, fileSize, imageFile2);
png_init_io(read_ptr, imageFile);
png_read_info(read_ptr, info_ptr);
png_uint_32 height;
height = info_ptr->height; …Run Code Online (Sandbox Code Playgroud) libpng ×10
png ×4
c ×3
macos ×3
deflate ×2
matplotlib ×2
zlib ×2
compression ×1
freetype ×1
imagemagick ×1
linker ×1
linux ×1
mingw ×1
msys ×1
pygame ×1
python-2.7 ×1