Loading PNG Image Problem

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Loading PNG Image Problem

Post by jstph »

Magick,
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 http://www.satoricm.net/tmpfile/ccitt.png
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);
	DestroyExceptionInfo(exception);
	DestroyImageInfo(imageinfo);
	fclose(input);

	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);

	DestroyExceptionInfo(exception);
	DestroyImageInfo(outimageinfo);
	DestroyImage(image);
	fclose(output);
Post Reply