Page 1 of 1

Loading PNG Image Problem

Posted: 2018-08-01T14:23:16-07:00
by jstph
I have a PNG Image, which may have some issue. I have been able to load it with IM before.
But I have problem in IM7.
The ImageMagick loaded it with a error message "Read error at scanline 4294967295; got 4529 bytes, expected 4560. `TIFFFillStrip' @ error/tiff.c/TIFFErrors/572", and exceptionInfo has the severity "CodeError(450)" . But the error_number is 0.

I have tried the same image with GDIPlus and it successfully loaded it.

The test image is located at
My System is window 10 pro.
IDE is vs 2015
IM is IM-windows 7.0.5-4.

the following is the test code.

Code: Select all

	ImageInfo* imageinfo = AcquireImageInfo();
	Image* image;
	ExceptionInfo* exception = AcquireExceptionInfo();
	char* inputFileName = "ccitt.png";
	int size = strlen(inputFileName) + 1;
	memcpy(imageinfo->filename, inputFileName, size);
	FILE* input = 0;
	fopen_s(&input, inputFileName, "rb");
	SetImageInfoFile(imageinfo, input);
	image = ReadImage(imageinfo, exception);

	exception = AcquireExceptionInfo();
	ImageInfo* outimageinfo = AcquireImageInfo();
	char* outputFileName = "newccitt.png";
	size = strlen(outputFileName) + 1;
	memcpy(outimageinfo->filename, outputFileName, size);
	FILE* output = 0;
	fopen_s(&output, outputFileName, "wb");
	SetImageInfoFile(outimageinfo, output);
	WriteImage(outimageinfo, image, exception);