I am trying to insert ICC profile data parsed from a JPG/JPEG image back into a PNG image. I have parsed this data taking help from this and this source, But I am unable to find solutions for re-inserting this profile back into a PNG Image. I have looked at PNG specs and tried to insert the data byte wise (following these instructions) but the newly formed image is getting corrupted. Any help or guidance towards the right direction is highly appreciated.
I am trying to achieve the above task in frontend and I am using React-JS for the same.