c# - Extracted thumbnail from DNG image using DCRaw -
i using dcraw command line utility extract thumbnails dng images. thumbnail colors way off , inverting them not help.
i took photo camera , preview looks this:
here how call dcraw:
settings osettings = settings.getinstance(); var startinfo = new processstartinfo(dcrawpath) { arguments = "-e \"" + sinputfilename + "\"", useshellexecute = true, redirectstandardoutput = false, windowstyle = processwindowstyle.hidden, createnowindow = true, workingdirectory = rootdirectory }; var process = process.start(startinfo);
the result ppm file looks this:
i tried inverting thumbnail using code:
static readonly colormatrix _inversecolormatrix = new colormatrix(new[] { new float[] {-1, 0, 0, 0, 0}, new float[] {0, -1, 0, 0, 0}, new float[] {0, 0, -1, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {1, 1, 1, 0, 1} }); public static bitmap inverseimage(bitmap source) { var newbitmap = new bitmap(source.width, source.height); using (var g = graphics.fromimage(newbitmap)) { var attributes = new imageattributes(); attributes.setcolormatrix(_inversecolormatrix); g.drawimage(source, new rectangle(0, 0, source.width, source.height), 0, 0, source.width, source.height, graphicsunit.pixel, attributes); } return newbitmap; }
this gave me thumbnail so:
i got same result using photoshop means code inverting image correctly seems not way parse dng thumbnails.
how can invert thumbnail generated dcraw give correct colors first image.
note: camera lumia 1020 dng output.
edit: original dng file can downloaded here
Comments
Post a Comment