Update: The ICC profile is probably not truly broken after all. It is known that libpng is overly strict with this, and there's a way to turn this error checking off. That is what I will ultimately do.
Some references: https://sourceforge.net/p/png-mng/mailman/message/32003609/ <https://sourceforge.net/p/png-mng/mailman/message/32003609/> https://github.com/kornelski/pngquant/issues/190 <https://github.com/kornelski/pngquant/issues/190> > On Aug 2, 2020, at 3:52 PM, Larry Gritz <[email protected]> wrote: > > OK, I think I understand what's going on here. > > Your particular TIFF file (that you sent me) has an embedded ICC color > profile in the TIFF header. When you try to write it to PNG, OIIO is passing > along the ICC profile. > > libpng has some sort of validity check of any ICC profile you hand it, and > this one is failing, it looks invalid somehow. I'm not sure why, but > nonetheless, that is libpng's opinion of it. And it's considering it an error. > > I don't know how to fix it other than to strip the ICC profile before trying > to write the PNG file. From Python, you should be able to do this: > > in_buf_rgba.specmod().erase_attribute("ICCProfile") > > ... except OOPS, I seem to have an error in the python bindings for > erase_attribute, I will post a fix for that. > > Note also that the error showed up even using oiiotool: > > oiiotool SAND_01_COL_16_bits.tif -o out.png > > and is fixed with: > > oiiotool SAND_01_COL_16_bits.tif -eraseattrib ICCProfile -o out.png > > (that does work, so maybe you can use this as a workaround) > > >> On Aug 2, 2020, at 12:49 PM, Larry Gritz <[email protected] >> <mailto:[email protected]>> wrote: >> >> Aha, the good news is that I can reproduce the problem with the file you >> sent me! Stay tuned, digging into it... >> >> >> >>> On Jul 31, 2020, at 8:12 AM, Larry Gritz <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> Any TIFF file? Or only particular ones? Can you email me a particular TIFF >>> file that exhibits this problem so I can try to reproduce? >>> >>> Also, do you know what the value of the 'bitdepth' variable is in this case? >>> >>> Which version of OIIO are you using? >>> >>> -- lg >>> >>> >>>> On Jul 31, 2020, at 2:53 AM, MONSIEUR LIXM <[email protected] >>>> <mailto:[email protected]>> wrote: >>>> >>>> >>>> Hey, thanks for your answer, >>>> So it is just a message that doesn’t stop the code BUT the written file is >>>> actually corrupted.(you can’t read it) >>>> >>>> I didn’t compiled OIIO myself , I am using a Python Wheel made by Fredrik >>>> Averpil. But this is the only error i had from now, if i convert an >>>> exr/hdr to png I don’t have any issue. It only pop for tiff to png. >>>> >>>> Liam. >>>> >>>> >>>> ---------------------------------------------------------------------- >>>> >>>> Message: 2 >>>> Date: Wed, 29 Jul 2020 10:30:36 -0700 >>>> From: Larry Gritz <[email protected] <mailto:[email protected]>> >>>> To: OpenImageIO developers <[email protected] >>>> <mailto:[email protected]>> >>>> Subject: Re: [Oiio-dev] LibPng error >>>> Message-ID: <[email protected] >>>> <mailto:[email protected]>> >>>> Content-Type: text/plain; charset="utf-8" >>>> >>>> Is it actually crashing or doing the wrong thing when writing the file? Or >>>> are you just getting a stray message printed from inside libpng that is, >>>> in actuality, a harmless false alarm? >>>> >>>> Do you know what version of libpng you are using, and are you sure you >>>> have compiled it in release mode and not some kind of debug mode? >>>> >>>> >>>> > On Jul 29, 2020, at 4:50 AM, MONSIEUR LIXM <[email protected] >>>> > <mailto:[email protected]>> wrote: >>>> > >>>> > Hello, >>>> > I run into an error when i?m trying to convert a .tiff into .png : >>>> > ? libpng error: known incorrect sRGB profile ? >>>> > >>>> > Can?t find where it comes from , it just seems that the message pop >>>> > after this last line : >>>> > >>>> > in_buf_rgba.specmod().attribute("compression", self.compression.lower()) >>>> > in_buf_rgba.specmod().attribute("oiio:ColorSpace", "sRGB") # >>>> > self.out_cs if not ODT_DICO.get(self.odt) else self.odt) >>>> > bitdepth = self.bitdepth_picker(in_buf_data.nativespec().format, >>>> > self.out_bitdepth) >>>> > in_buf_rgba.set_write_format(bitdepth) >>>> > >>>> > here my variable ? bitdepth ? is a string as ? UINT8, UINT16, ? ? >>>> > I suppose that I am missing a metadata information to make it work. >>>> > >>>> > If you could point me in which direction to go. >>>> > >>>> > Kindly, Liam Collod. >>>> > >>>> > >>> >>> -- >>> Larry Gritz >>> [email protected] <mailto:[email protected]> >>> >>> >>> >>> >>> _______________________________________________ >>> Oiio-dev mailing list >>> [email protected] <mailto:[email protected]> >>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org >>> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org> >> -- >> Larry Gritz >> [email protected] <mailto:[email protected]> >> >> >> >> >> _______________________________________________ >> Oiio-dev mailing list >> [email protected] <mailto:[email protected]> >> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > > -- > Larry Gritz > [email protected] <mailto:[email protected]> > > > > > _______________________________________________ > Oiio-dev mailing list > [email protected] > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org -- Larry Gritz [email protected]
_______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
