You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@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 ?
Had a crack at this and I'm so close. I'm reading the stream fine without error but something isn't right after. It looks like my offset calculation is wrong. Could someone have a look?
I can decode your rgb image perfectly now and my rgba image also. I have one test image though (rgb 8x8) that is showing a two pixel error and I don't know why. If anyone reading could have a look that would be great.
Here's your image decoded then encoded in non-interlaced mode.
So the only problem is with rgb 8x8 image ? Can you point me to the code? is there a failing test? I have no experience on image manipulation but I will be glad to help and try to solve this. Maybe we can take the converstaion offline to slack so you can guide me in how to approach the problem?
I have no idea if this has or not anything to do with the interlace thing and need some guidance on how to test if it works with your interlaced.png (rgba 8x8) file.
Activity
JimBobSquarePants commentedon Oct 30, 2016
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.
JimBobSquarePants commentedon Oct 30, 2016
From @Bartmax on May 6, 2016 4:39
Thanks for the fast reply.
Here is a sample file that is failing. I have 3 out of 10 that seems to be interlaced :(
JimBobSquarePants commentedon Oct 30, 2016
No worries. I'll branch off and try to tinker with it. Fingers crossed it's not too difficult.
JimBobSquarePants commentedon Oct 30, 2016
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 commentedon Oct 30, 2016
From @MarcosMeli on August 29, 2016 16:28
@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
JimBobSquarePants commentedon Oct 30, 2016
From @dlemstra on August 29, 2016 16:59
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.
JimBobSquarePants commentedon Oct 30, 2016
From @MarcosMeli on August 29, 2016 17:50
@dlemstra Thanks for clarification, I understand now.
Initial attempt to decode png. Touch #9
JimBobSquarePants commentedon Dec 3, 2016
Had a crack at this and I'm so close. I'm reading the stream fine without error but something isn't right after. It looks like my offset calculation is wrong. Could someone have a look?
Much better output. Nearly there. Touch #9
JimBobSquarePants commentedon Dec 4, 2016
Ok @Bartmax so I'm almost there with this.
I can decode your rgb image perfectly now and my rgba image also. I have one test image though (rgb 8x8) that is showing a two pixel error and I don't know why. If anyone reading could have a look that would be great.
Here's your image decoded then encoded in non-interlaced mode.
Bartmax commentedon Dec 4, 2016
So the only problem is with rgb 8x8 image ? Can you point me to the code? is there a failing test? I have no experience on image manipulation but I will be glad to help and try to solve this. Maybe we can take the converstaion offline to slack so you can guide me in how to approach the problem?
Bartmax commentedon Dec 4, 2016
played with the code, I see some errors (or I think are errors) on the tests, see:
I have no idea if this has or not anything to do with the interlace thing and need some guidance on how to test if it works with your
interlaced.png(rgba 8x8) file.Fix #9
JimBobSquarePants commentedon Dec 4, 2016
Thanks for highlighting the failing tests, not sure how that slipped through but they are unrelated. I've fixed them in my branch.
I managed to fix the decoder! Turns out I wasn't clearing an array at the correct time.
Bartmax commentedon Dec 4, 2016
@JimBobSquarePants well excellent news!! hope to be more useful next time 😄
JimBobSquarePants commentedon Dec 4, 2016
Don't worry, you were useful 👍
I've merged my branch and you should see a shiny new working build now.
Initial attempt to decode png. Touch SixLabors#9
Much better output. Nearly there. Touch SixLabors#9
Fix SixLabors#9
Merge pull request #9 from SixLabors/master