Imageprocessor: Interlacing is not supported

Created on 6 May 2016  路  8Comments  路  Source: JimBobSquarePants/ImageProcessor

When using a Png file I get this error:

ImageProcessorCore.ImageFormatException: Interlacing is not supported

some png works but some doesn't.

The code is here:
https://github.com/JimBobSquarePants/ImageProcessor/blob/abbf63f863635d4df1a04d322eccd425db7e82db/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs#L385

What does this mean? is this a limitation of the library or am I doing something wrong or a bug?

blocking codecs core enhancement hacktoberfest help needed

Most helpful comment

No worries. I'll branch off and try to tinker with it. Fingers crossed it's not too difficult.

All 8 comments

Hi @Bartmax

It means exactly that. Png files can be interlaced but it is strongly recommended not to do that as it hurts compression, increasing filesize.

See

Interlaced png files are generally uncommon so I haven't gone out of my way to support them cos it's complex. I could maybe add support in the future though as there is good reference material to base my code on so if you could share a failing image that would be really useful.

Thanks for the fast reply.

Here is a sample file that is failing. I have 3 out of 10 that seems to be interlaced :(

546ce378-2bcf-4604-8338-91d9065727c4

No worries. I'll branch off and try to tinker with it. Fingers crossed it's not too difficult.

This is tricky stuff...

I've been looking at the spec and also the Golang implementation.

https://www.w3.org/TR/PNG/
https://golang.org/src/image/png/reader.go

Reading up it looks like I need to decode each scanline 8 times which will require some significant refactoring here.

https://github.com/JimBobSquarePants/ImageProcessor/blob/7d28a87716e4b7c2dea73bc0fb804873d30372f6/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs#L242

I could really do with someone who has done this before stepping up and adding the code.

@JimBobSquarePants
Just a little question here. There is an option to use the .Net native image load implementation and convert the resulting Bitmap to the format you need ?

ie. try to use custom decode for the pngs but, if interlaced, so use Bitmap constructor: https://msdn.microsoft.com/en-us/library/z7ha67kw(v=vs.110).aspx

Thanks

The library should build on .NET Core where we don't have the Image class of System.Drawing. Adding it to the encoder should be the way to go.

@dlemstra Thanks for clarification, I understand now.

This issue was moved to JimBobSquarePants/ImageSharp#9

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DocCaliban picture DocCaliban  路  4Comments

SergeBerwert picture SergeBerwert  路  8Comments

xumix picture xumix  路  10Comments

x2764tech picture x2764tech  路  7Comments

skttl picture skttl  路  5Comments