lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.08k stars 425 forks source link

png on iOS/OSX #124

Open mrpuzzler opened 4 years ago

mrpuzzler commented 4 years ago

Add support for non-standard PNG on iOS/OSX where xCode optimizes it.

http://www.pngsquared.com/ http://fileformats.archiveteam.org/wiki/CgBI

mrpuzzler commented 4 years ago

Looks like very minor changes https://github.com/jongwook/libpng/commits/master

zvezdochiot commented 4 years ago

http://fileformats.archiveteam.org/wiki/CgBI say:

It is not compatible with PNG.

mrpuzzler commented 4 years ago

As I mentioned, it's very easy to handle it.

zvezdochiot commented 4 years ago

@mrpuzzler say:

it's very easy to handle it.

Easy? Where is this easy PR? Forgot to send?

mrpuzzler commented 4 years ago

did you see this link https://github.com/jongwook/libpng/commits/master ?

zvezdochiot commented 4 years ago

@mrpuzzler say:

did you see

https://github.com/jongwook/libpng/commits/master say:

with 25,709 additions and 0 deletions.

Easy?

mrpuzzler commented 4 years ago

https://github.com/jongwook/libpng/commit/b234298b0ef8a946f3b65a79c52f850400e59fe2

On Sat, Feb 22, 2020 at 10:20 PM звездочёт notifications@github.com wrote:

@mrpuzzler https://github.com/mrpuzzler say:

did you see

https://github.com/jongwook/libpng/commits/master say:

with 25,709 additions and 0 deletions.

Easy?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lvandeve/lodepng/issues/124?email_source=notifications&email_token=ABL7UYIRGGVJB32IQXK5XWTREF3I5A5CNFSM4KFH4Z7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMVINBI#issuecomment-589989509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL7UYNQ4DW3ANXI7XOBW3DREF3I5ANCNFSM4KFH4Z7A .

zvezdochiot commented 4 years ago

@mrpuzzler say:

PNG_EXTERN void png_handle_CgBI PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); png_handle_CgBI(png_ptr, info_ptr, length); png_ptr->using_CgBI_extension png_ptr->using_CgBI_extension=1;

https://github.com/lvandeve/lodepng/search?q=CgBI&unscoped_q=CgBI

Very interesting. Very.

Goto https://github.com/lvandeve/lodepng/issues/124#issuecomment-589968606

lvandeve commented 4 years ago

Thanks for the suggestion

This is out of scope for lodepng, since it's not part of standard PNG.

However, it may be possible to use lodepng to handle most standard parts of the PNG, and handle the custom chunk yourself in your own code: for example you may be able to use the lodepng_chunk_next or lodepng_chunk_find functions to go to that chunk (and to remove it from the data before giving it to lodepng if lodepng treats it as error due to critical chunk). You may be able to override bits in the IHDR chunk to set a valid color type (for standard PNG) in it that matches the amount of channels. Would that work?