image - Do the libjpeg and the .Net jpeg codec really differ significantly on monochrome data? -


i work lot of monochrome image data , morning noticed there appears significant difference between way libjpeg , .net jpeg codec handle monochrome data. appears monochrome image saved @ quality setting using libjpeg , opened using default .net jpeg codec loads 16 different shades of gray , intermediate shades rendered stippled.

here histogram of smooth gradient saved libjpeg , loaded .net

histogram of codec conflict affected gradient

the histogram should have been level.

and here (zoomed in) sample of gradient looks (it should smooth transition) enter image description here

this should smooth transition gray 85 on left gray 136 on right 4 shades of gray rendered make transition.

my question crazy , if not how far codec discrepancy go? there workaround if using both libraries in different programs?

i not blaming either codec, pointing out appears discrepancy. noticed images knew created using libjpeg, assumed quality setting issue, tried using faststone image resizer create test images , got same result, tried using irfanview , got same result again. both of programs must use jpeg library tend assume using libjpeg , there genuine codec conflict.

on loading side have run same result loading images both own .net code , using paint.net.

finally, here sample @ normal resolution can download , try yourself. loading in programs give nice gradient (e.g. browser) loading own .net code, or paint.net give dithered gradient above rendered using 16 shades of gray.

enter image description here

does know more this, how far goes , workarounds might be?

i able reproduce symptoms opening sample image in version of paint bundled windows 7. analyzing file shows valid jpeg, , having show in browser confirms this. looks microsoft messed bad. has been submitted bug:

https://connect.microsoft.com/visualstudio/feedback/details/597657/grayscale-jpeg-image-read-as-format8bppindexed-but-quantized-as-format4bppindexed#details

http://social.msdn.microsoft.com/forums/en-us/wpf/thread/9132e2bd-23cc-4e5a-a783-1fa4abe11624/

the workaround create jpeg full color image, put grayscale pixel values it.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -