PNG encoder changes?

Oystein Bjorke 4 years ago 0
This discussion was imported from CodePlex

thomasdr wrote at 2013-12-16 19:25:

Can you explain the recent PNG encoder changes? My image is now rotated 90 degrees clockwise from previous.

objo wrote at 2013-12-16 20:55:

I think this is related to the breaking change applied 2013-11-14:
https://oxyplot.codeplex.com/SourceControl/changeset/62c4f57c6da9
(to make all the pixel arrays consistent - in OxyImage, pdf exporter, png encoder etc)

See the documentation for the PngEncoder.Export method, I guess you need to change the order of the indices in the source array:
        /// <summary>
        /// Encodes the specified image data to png.
        /// </summary>
        /// <param name="pixels">
        /// The pixel data indexed as [x,y] (bottom line first).
        /// </param>
        /// <returns>
        /// The png image data.
        /// </returns>
        public byte[] Encode(OxyColor[,] pixels)
Let me know if it would be a better idea that pixel arrays are indexed as [y,x] or top line first!

thomasdr wrote at 2013-12-30 15:45:

OK, I switched the indexes and everything works fine. Hope you received the PDF book from your Amazon wish list. Thanks again for this library.

objo wrote at 2014-01-07 21:36:

Thank you! I received the book yesterday! I am looking really forward to read it, I find PDF export to be very exciting :) (and I want to learn more about text encoding and font embedding)
CodePlex