stefan samociuk
stefan samociuk

Reputation: 1

Does libpng have an upper limit on image width?

I am converting large raw data to image files using Ubuntu Linux. Works fine up to and including 1,000,000 pixels wide. Over this, eg 1,000,001, I get an error:

libpng warning: Image width exceeds user limit in IHDR libpng error: Invalid IHDR data Aborted (core dumped)

Just wondering if there is a test in libpng if(width > 1000000) error

Thanks

All works well up to 1000000 limit and no problems with memory.

Upvotes: 0

Views: 120

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207778

libpng imposes a limit of 1 million rows and 1 million columns. The following is extracted from libpng-manual.txt:

The PNG specification allows the width and height of an image to be as large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns. For safety, libpng imposes a default limit of 1 million rows and columns. Larger images will be rejected immediately with a png_error() call.

A method for overriding this limit follows immediately after the above paragraph in the documentation.

Upvotes: 0

Related Questions