DNG to JPG results in distorted image.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Locked
Alexis Rombaut
Posts: 6
Joined: 2013-11-28T09:00:44-07:00
Authentication code: 6789

DNG to JPG results in distorted image.

Post by Alexis Rombaut »

DNG conversion results in distorted image.
Image

Windows reports a bit depth of 24, while IM reports 16. Judging on the EXIF metadata, I think it should be 24 indeed (Bits Per Sample: 8 * Samples Per Pixel:3 --> 24).

Code: Select all

/bin/convert input.dng output.jpg

Code: Select all

root@dev-storage:/work/mediahaven/tools/imagemagick# ./bin/convert -version
Version: ImageMagick 7.0.9-22 Q16 x86_64 2020-02-12 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5) 
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib
Input image

Code: Select all

root@dev-storage:/work/mediahaven/tools/imagemagick# ./bin/identify -verbose /mnt/STORAGE/TESTSUITE/old_imagemagick_generates_bad_preview_but_must_work_OK.dng 
Image: /mnt/STORAGE/TESTSUITE/old_imagemagick_generates_bad_preview_but_must_work_OK.dng
  Format: DNG (Digital Negative)
  Class: DirectClass
  Geometry: 3579x2551+0+0
  Units: Undefined
  Colorspace: sRGB
  Type: Palette
  Base type: Undefined
  Endianess: Undefined
  Depth: 16-bit
  Channel depth:
    Red: 16-bit
    Green: 16-bit
    Blue: 16-bit
  Channel statistics:
    Pixels: 9130029
    Red:
      min: 0  (0)
      max: 65535 (1)
      mean: 22153.4 (0.338039)
      standard deviation: 27043.7 (0.41266)
      kurtosis: -1.40169
      skewness: 0.623265
      entropy: 0.557751
    Green:
      min: 0  (0)
      max: 65535 (1)
      mean: 22153.1 (0.338034)
      standard deviation: 27043.2 (0.412653)
      kurtosis: -1.4017
      skewness: 0.623261
      entropy: 0.557751
    Blue:
      min: 0  (0)
      max: 65535 (1)
      mean: 22153.4 (0.338039)
      standard deviation: 27043.7 (0.41266)
      kurtosis: -1.40169
      skewness: 0.623268
      entropy: 0.557751
  Image statistics:
    Overall:
      min: 0  (0)
      max: 65535 (1)
      mean: 22153.3 (0.338037)
      standard deviation: 27043.5 (0.412658)
      kurtosis: -1.40169
      skewness: 0.623265
      entropy: 0.557751
  Colors: 203
  Histogram:
   4602145: (0,0,0) #000000000000 black
     11144: (114,114,114) #007200720072 srgb(0.44358,0.44358,0.44358)
     17700: (233,233,233) #00E900E900E9 srgb(0.906615,0.906615,0.906615)
     17288: (320,320,320) #014001400140 srgb(1.24514,1.24514,1.24514)
     35651: (462,462,462) #01CE01CE01CE srgb(1.79767,1.79767,1.79767)
     20168: (622,622,622) #026E026E026E srgb(2.42023,2.42023,2.42023)
     16643: (819,819,819) #033303330333 srgb(3.18677,3.18677,3.18677)
     20027: (1108,1108,1108) #045404540454 srgb(4.31128,4.31128,4.31128)
     23818: (1369,1369,1369) #055905590559 srgb(5.32685,5.32685,5.32685)
     26762: (1808,1813,1813) #071007150715 srgb(7.03502,7.05447,7.05447)
     26511: (2326,2326,2326) #091609160916 srgb(9.05058,9.05058,9.05058)
     22257: (2706,2706,2706) #0A920A920A92 srgb(10.5292,10.5292,10.5292)
     16956: (3337,3337,3337) #0D090D090D09 srgb(12.9844,12.9844,12.9844)
     17474: (4043,4043,4043) #0FCB0FCB0FCB srgb(15.7315,15.7315,15.7315)
     21250: (4555,4555,4555) #11CB11CB11CB srgb(17.7237,17.7237,17.7237)
     22389: (5379,5379,5379) #150315031503 srgb(20.93,20.93,20.93)
     22370: (5954,5954,5954) #174217421742 srgb(23.1673,23.1673,23.1673)
     21594: (6531,6531,6531) #198319831983 srgb(25.4125,25.4125,25.4125)
     20947: (7097,7101,7101) #1BB91BBD1BBD srgb(27.6148,27.6304,27.6304)
     21251: (7677,7677,7677) #1DFD1DFD1DFD srgb(29.8716,29.8716,29.8716)
     21436: (8249,8249,8249) #203920392039 srgb(32.0973,32.0973,32.0973)
     21924: (8823,8823,8823) #227722772277 srgb(34.3307,34.3307,34.3307)
     21079: (9394,9394,9394) #24B224B224B2 srgb(36.5525,36.5525,36.5525)
     20121: (9965,9968,9968) #26ED26F026F0 srgb(38.7743,38.786,38.786)
     19256: (10539,10539,10539) #292B292B292B srgb(41.0078,41.0078,41.0078)
     19358: (11111,11111,11111) #2B672B672B67 srgb(43.2335,43.2335,43.2335)
     18820: (11398,11398,11398) #2C862C862C86 srgb(44.3502,44.3502,44.3502)
     18372: (11969,11969,11969) #2EC12EC12EC1 srgb(46.572,46.572,46.572)
     17526: (12540,12540,12540) #30FC30FC30FC srgb(48.7938,48.7938,48.7938)
     17276: (12826,12826,12826) #321A321A321A srgb(49.9066,49.9066,49.9066)
     16594: (13112,13110,13112) #333833363338 srgb(51.0195,51.0117,51.0195)
     16186: (13682,13682,13682) #357235723572 srgb(53.2374,53.2374,53.2374)
     16107: (13968,13968,13968) #369036903690 srgb(54.3502,54.3502,54.3502)
     15809: (14539,14539,14539) #38CB38CB38CB srgb(56.572,56.572,56.572)
     15696: (14824,14824,14824) #39E839E839E8 srgb(57.6809,57.6809,57.6809)
     15282: (15110,15110,15110) #3B063B063B06 srgb(58.7938,58.7938,58.7938)
     15312: (15966,15966,15966) #3E5E3E5E3E5E srgb(62.1245,62.1245,62.1245)
     15530: (16252,16252,16252) #3F7C3F7C3F7C srgb(63.2374,63.2374,63.2374)
     15276: (16536,16536,16536) #409840984098 srgb(64.3424,64.3424,64.3424)
     15220: (16821,16821,16821) #41B541B541B5 srgb(65.4514,65.4514,65.4514)
     14805: (17392,17392,17392) #43F043F043F0 srgb(67.6732,67.6732,67.6732)
     14214: (17677,17677,17677) #450D450D450D srgb(68.7821,68.7821,68.7821)
     13573: (17961,17961,17961) #462946294629 srgb(69.8872,69.8872,69.8872)
     12814: (18248,18248,18248) #474847484748 srgb(71.0039,71.0039,71.0039)
     12597: (18817,18817,18817) #498149814981 srgb(73.2179,73.2179,73.2179)
     11970: (19103,19103,19103) #4A9F4A9F4A9F srgb(74.3307,74.3307,74.3307)
     11769: (19387,19387,19387) #4BBB4BBB4BBB srgb(75.4358,75.4358,75.4358)
     11373: (19672,19672,19672) #4CD84CD84CD8 srgb(76.5447,76.5447,76.5447)
     10939: (19956,19956,19956) #4DF44DF44DF4 srgb(77.6498,77.6498,77.6498)
     10762: (20526,20526,20526) #502E502E502E srgb(79.8677,79.8677,79.8677)
     10441: (20811,20811,20811) #514B514B514B srgb(80.9767,80.9767,80.9767)
     10220: (21095,21095,21095) #526752675267 srgb(82.0817,82.0817,82.0817)
     10192: (21380,21380,21380) #538453845384 srgb(83.1907,83.1907,83.1907)
     10717: (21664,21662,21664) #54A0549E54A0 srgb(84.2957,84.2879,84.2957)
     10974: (21949,21949,21949) #55BD55BD55BD srgb(85.4047,85.4047,85.4047)
     11202: (22234,22234,22234) #56DA56DA56DA srgb(86.5136,86.5136,86.5136)
     11792: (22519,22517,22519) #57F757F557F7 srgb(87.6226,87.6148,87.6226)
     11774: (23087,23085,23087) #5A2F5A2D5A2F srgb(89.8327,89.8249,89.8327)
     12011: (23656,23656,23656) #5C685C685C68 srgb(92.0467,92.0467,92.0467)
     12195: (23941,23941,23941) #5D855D855D85 srgb(93.1556,93.1556,93.1556)
     12449: (24225,24225,24225) #5EA15EA15EA1 srgb(94.2607,94.2607,94.2607)
     12706: (24510,24510,24510) #5FBE5FBE5FBE srgb(95.3696,95.3696,95.3696)
     12656: (24793,24793,24793) #60D960D960D9 srgb(96.4708,96.4708,96.4708)
     12766: (25077,25077,25077) #61F561F561F5 srgb(97.5759,97.5759,97.5759)
     13026: (25362,25362,25362) #631263126312 srgb(98.6848,98.6848,98.6848)
     12705: (25646,25644,25646) #642E642C642E srgb(99.7899,99.7821,99.7899)
     12948: (25930,25930,25930) #654A654A654A srgb(100.895,100.895,100.895)
     13078: (26214,26214,26214) #666666666666 grey40
     13148: (26498,26498,26498) #678267826782 srgb(103.105,103.105,103.105)
     12925: (26783,26783,26783) #689F689F689F srgb(104.214,104.214,104.214)
     12725: (27067,27067,27067) #69BB69BB69BB srgb(105.319,105.319,105.319)
     13008: (27351,27351,27351) #6AD76AD76AD7 srgb(106.424,106.424,106.424)
     12516: (27635,27635,27635) #6BF36BF36BF3 srgb(107.529,107.529,107.529)
     12416: (27919,27919,27919) #6D0F6D0F6D0F srgb(108.634,108.634,108.634)
     12584: (28487,28487,28487) #6F476F476F47 srgb(110.844,110.844,110.844)
     12690: (28771,28771,28771) #706370637063 srgb(111.949,111.949,111.949)
     12770: (29055,29055,29055) #717F717F717F srgb(113.054,113.054,113.054)
     12793: (29339,29339,29339) #729B729B729B srgb(114.16,114.16,114.16)
     12829: (29622,29622,29622) #73B673B673B6 srgb(115.261,115.261,115.261)
     12912: (29906,29906,29906) #74D274D274D2 srgb(116.366,116.366,116.366)
     13092: (30190,30189,30190) #75EE75ED75EE srgb(117.471,117.467,117.471)
     13184: (30475,30475,30475) #770B770B770B srgb(118.58,118.58,118.58)
     13449: (30758,30758,30758) #782678267826 srgb(119.681,119.681,119.681)
     13351: (31041,31041,31041) #794179417941 srgb(120.782,120.782,120.782)
     13400: (31326,31326,31326) #7A5E7A5E7A5E srgb(121.891,121.891,121.891)
     13752: (31610,31610,31610) #7B7A7B7A7B7A srgb(122.996,122.996,122.996)
     27680: (32177,32177,32177) #7DB17DB17DB1 srgb(125.202,125.202,125.202)
     14408: (32461,32461,32461) #7ECD7ECD7ECD srgb(126.307,126.307,126.307)
     14819: (32744,32743,32744) #7FE87FE77FE8 srgb(127.409,127.405,127.409)
     15112: (33027,33027,33027) #810381038103 srgb(128.51,128.51,128.51)
     15667: (33311,33311,33311) #821F821F821F srgb(129.615,129.615,129.615)
     15472: (33595,33595,33595) #833B833B833B srgb(130.72,130.72,130.72)
     15360: (33879,33879,33879) #845784578457 srgb(131.825,131.825,131.825)
     15212: (34162,34162,34162) #857285728572 srgb(132.926,132.926,132.926)
     14786: (34446,34446,34446) #868E868E868E srgb(134.031,134.031,134.031)
     28362: (34730,34730,34730) #87AA87AA87AA srgb(135.136,135.136,135.136)
     13628: (35013,35013,35013) #88C588C588C5 srgb(136.237,136.237,136.237)
     13262: (35296,35296,35296) #89E089E089E0 srgb(137.339,137.339,137.339)
     13164: (35580,35580,35580) #8AFC8AFC8AFC srgb(138.444,138.444,138.444)
     12983: (35863,35863,35863) #8C178C178C17 srgb(139.545,139.545,139.545)
     12832: (36146,36146,36146) #8D328D328D32 srgb(140.646,140.646,140.646)
     13095: (36430,36429,36430) #8E4E8E4D8E4E srgb(141.751,141.747,141.751)
     26229: (36996,36996,36996) #908490849084 srgb(143.953,143.953,143.953)
     13413: (37280,37280,37280) #91A091A091A0 srgb(145.058,145.058,145.058)
     13338: (37563,37563,37563) #92BB92BB92BB srgb(146.16,146.16,146.16)
     13686: (37847,37847,37847) #93D793D793D7 srgb(147.265,147.265,147.265)
     13766: (38131,38130,38129) #94F394F294F1 srgb(148.37,148.366,148.362)
     26680: (38414,38413,38412) #960E960D960C srgb(149.471,149.467,149.463)
     13427: (38697,38697,38696) #972997299728 srgb(150.572,150.572,150.568)
     13323: (38980,38979,38978) #984498439842 srgb(151.673,151.669,151.665)
     13451: (39263,39262,39262) #995F995E995E srgb(152.774,152.77,152.77)
     13507: (39547,39546,39545) #9A7B9A7A9A79 srgb(153.879,153.875,153.872)
     26099: (39830,39830,39829) #9B969B969B95 srgb(154.981,154.981,154.977)
     12812: (40113,40112,40112) #9CB19CB09CB0 srgb(156.082,156.078,156.078)
     13029: (40397,40396,40395) #9DCD9DCC9DCB srgb(157.187,157.183,157.179)
     13193: (40680,40679,40680) #9EE89EE79EE8 srgb(158.288,158.284,158.288)
     25375: (40962,40962,40962) #A002A002A002 srgb(159.385,159.385,159.385)
     11963: (41245,41245,41245) #A11DA11DA11D srgb(160.486,160.486,160.486)
     11732: (41529,41528,41529) #A239A238A239 srgb(161.591,161.588,161.591)
     11624: (41812,41811,41812) #A354A353A354 srgb(162.693,162.689,162.693)
     11269: (42095,42094,42095) #A46FA46EA46F srgb(163.794,163.79,163.794)
     10462: (42378,42377,42378) #A58AA589A58A srgb(164.895,164.891,164.895)
      9458: (42661,42660,42661) #A6A5A6A4A6A5 srgb(165.996,165.992,165.996)
      9128: (42944,42943,42944) #A7C0A7BFA7C0 srgb(167.097,167.093,167.097)
     17645: (43227,43226,43227) #A8DBA8DAA8DB srgb(168.198,168.195,168.198)
      8679: (43510,43509,43510) #A9F6A9F5A9F6 srgb(169.3,169.296,169.3)
      8326: (43793,43792,43793) #AB11AB10AB11 srgb(170.401,170.397,170.401)
     15358: (44075,44075,44075) #AC2BAC2BAC2B srgb(171.498,171.498,171.498)
      6890: (44642,44641,44642) #AE62AE61AE62 srgb(173.704,173.7,173.704)
      6410: (44924,44924,44924) #AF7CAF7CAF7C srgb(174.802,174.802,174.802)
     12456: (45207,45206,45207) #B097B096B097 srgb(175.903,175.899,175.903)
      6033: (45490,45489,45490) #B1B2B1B1B1B2 srgb(177.004,177,177.004)
      6169: (45773,45772,45773) #B2CDB2CCB2CD srgb(178.105,178.101,178.105)
     11365: (46056,46055,46056) #B3E8B3E7B3E8 srgb(179.206,179.202,179.206)
      5302: (46338,46338,46338) #B502B502B502 srgb(180.304,180.304,180.304)
      4989: (46621,46620,46621) #B61DB61CB61D srgb(181.405,181.401,181.405)
      9598: (46904,46904,46904) #B738B738B738 srgb(182.506,182.506,182.506)
      4639: (47186,47186,47186) #B852B852B852 srgb(183.603,183.603,183.603)
      4290: (47470,47469,47470) #B96EB96DB96E srgb(184.708,184.704,184.708)
      8019: (47752,47752,47752) #BA88BA88BA88 srgb(185.805,185.805,185.805)
      3714: (48035,48034,48035) #BBA3BBA2BBA3 srgb(186.907,186.903,186.907)
      3690: (48317,48317,48317) #BCBDBCBDBCBD srgb(188.004,188.004,188.004)
      6591: (48601,48600,48601) #BDD9BDD8BDD9 srgb(189.109,189.105,189.109)
      3201: (48883,48882,48883) #BEF3BEF2BEF3 srgb(190.206,190.202,190.206)
      3047: (49165,49165,49165) #C00DC00DC00D srgb(191.304,191.304,191.304)
      5618: (49448,49447,49448) #C128C127C128 srgb(192.405,192.401,192.405)
      2643: (49731,49730,49731) #C243C242C243 srgb(193.506,193.502,193.506)
      5016: (50014,50013,50014) #C35EC35DC35E srgb(194.607,194.603,194.607)
      2285: (50296,50296,50296) #C478C478C478 srgb(195.704,195.704,195.704)
      2346: (50579,50578,50579) #C593C592C593 srgb(196.805,196.802,196.805)
      4103: (50861,50860,50861) #C6ADC6ACC6AD srgb(197.903,197.899,197.903)
      2017: (51144,51143,51144) #C7C8C7C7C7C8 srgb(199.004,199,199.004)
      3818: (51426,51425,51426) #C8E2C8E1C8E2 srgb(200.101,200.097,200.101)
      1813: (51709,51708,51709) #C9FDC9FCC9FD srgb(201.202,201.198,201.202)
      3367: (51992,51991,51992) #CB18CB17CB18 srgb(202.304,202.3,202.304)
      1715: (52274,52273,52274) #CC32CC31CC32 srgb(203.401,203.397,203.401)
      3228: (52556,52556,52556) #CD4CCD4CCD4C srgb(204.498,204.498,204.498)
      1522: (52839,52838,52839) #CE67CE66CE67 srgb(205.599,205.595,205.599)
      1452: (53121,53120,53121) #CF81CF80CF81 srgb(206.696,206.693,206.696)
      4277: (53404,53403,53404) #D09CD09BD09C srgb(207.798,207.794,207.798)
      2546: (53686,53685,53686) #D1B6D1B5D1B6 srgb(208.895,208.891,208.895)
      1160: (53969,53968,53969) #D2D1D2D0D2D1 srgb(209.996,209.992,209.996)
      2349: (54251,54250,54251) #D3EBD3EAD3EB srgb(211.093,211.089,211.093)
      1119: (54534,54533,54533) #D506D505D505 srgb(212.195,212.191,212.191)
      2326: (54817,54815,54816) #D621D61FD620 srgb(213.296,213.288,213.292)
      1100: (55099,55098,55098) #D73BD73AD73A srgb(214.393,214.389,214.389)
      2262: (55381,55380,55380) #D855D854D854 srgb(215.49,215.486,215.486)
      1152: (55663,55662,55663) #D96FD96ED96F srgb(216.588,216.584,216.588)
      2302: (55946,55944,55945) #DA8ADA88DA89 srgb(217.689,217.681,217.685)
      1136: (56228,56227,56227) #DBA4DBA3DBA3 srgb(218.786,218.782,218.782)
      2377: (56510,56509,56510) #DCBEDCBDDCBE srgb(219.883,219.879,219.883)
      1143: (56793,56792,56792) #DDD9DDD8DDD8 srgb(220.984,220.981,220.981)
      2313: (57075,57074,57074) #DEF3DEF2DEF2 srgb(222.082,222.078,222.078)
      1153: (57357,57356,57356) #E00DE00CE00C srgb(223.179,223.175,223.175)
      2392: (57640,57638,57639) #E128E126E127 srgb(224.28,224.272,224.276)
      1302: (57922,57921,57922) #E242E241E242 srgb(225.377,225.374,225.377)
      2420: (58204,58203,58204) #E35CE35BE35C srgb(226.475,226.471,226.475)
      1319: (58486,58485,58486) #E476E475E476 srgb(227.572,227.568,227.572)
      2840: (58768,58767,58768) #E590E58FE590 srgb(228.669,228.665,228.669)
      3620: (59050,59049,59050) #E6AAE6A9E6AA srgb(229.767,229.763,229.767)
      2552: (59333,59332,59333) #E7C5E7C4E7C5 srgb(230.868,230.864,230.868)
      7742: (59615,59613,59615) #E8DFE8DDE8DF srgb(231.965,231.957,231.965)
      6476: (59897,59896,59897) #E9F9E9F8E9F9 srgb(233.062,233.058,233.062)
     27049: (60179,60178,60179) #EB13EB12EB13 srgb(234.16,234.156,234.16)
    101503: (60461,60460,60461) #EC2DEC2CEC2D srgb(235.257,235.253,235.257)
    125918: (60743,60742,60743) #ED47ED46ED47 srgb(236.354,236.35,236.354)
     70780: (61025,61024,61025) #EE61EE60EE61 srgb(237.451,237.447,237.451)
    189453: (61307,61306,61307) #EF7BEF7AEF7B srgb(238.549,238.545,238.549)
     89131: (61590,61589,61590) #F096F095F096 srgb(239.65,239.646,239.65)
    189423: (61871,61870,61871) #F1AFF1AEF1AF srgb(240.743,240.739,240.743)
    206642: (62153,62152,62153) #F2C9F2C8F2C9 srgb(241.84,241.837,241.84)
    100272: (62436,62435,62436) #F3E4F3E3F3E4 srgb(242.942,242.938,242.942)
    254056: (62718,62716,62718) #F4FEF4FCF4FE srgb(244.039,244.031,244.039)
    112823: (63000,62999,63000) #F618F617F618 srgb(245.136,245.132,245.136)
    207138: (63282,63281,63282) #F732F731F732 srgb(246.233,246.23,246.233)
    151125: (63564,63563,63564) #F84CF84BF84C srgb(247.331,247.327,247.331)
     60791: (63846,63845,63846) #F966F965F966 srgb(248.428,248.424,248.428)
    117414: (64127,64126,64127) #FA7FFA7EFA7F srgb(249.521,249.518,249.521)
    134942: (64409,64408,64409) #FB99FB98FB99 srgb(250.619,250.615,250.619)
     56382: (64691,64690,64691) #FCB3FCB2FCB3 srgb(251.716,251.712,251.716)
     44321: (64974,64973,64974) #FDCEFDCDFDCE srgb(252.817,252.813,252.817)
     18341: (65255,65254,65255) #FEE7FEE6FEE7 srgb(253.911,253.907,253.911)
    104250: (65535,65535,65535) #FFFFFFFFFFFF white
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 3579x2551+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Profiles:
    Profile-xmp: 6826 bytes
  Properties:
    date:create: 2020-02-12T15:48:57+00:00
    date:modify: 2020-02-12T15:47:57+00:00
    dng:camera.model.name: 
    dng:create.date: 2010-11-13T23:24:04+00:00
    dng:exposure.time: 1/inf
    dng:f.number: 0.0
    dng:focal.length: 0.0
    dng:focal.length.in.35mm.format: 0 mm
    dng:iso.setting: 0.0
    dng:lens: 0.0-0.0mm f/0.0-0.0
    dng:lens.f.stops: 0.00
    dng:lens.type: 
    dng:make: PSD
    dng:max.aperture.at.max.focal: 0.0
    dng:max.aperture.at.min.focal: 0.0
    dng:max.aperture.value: 0.0
    dng:max.focal.length: 0.0 mm
    dng:min.focal.length: 0.0 mm
    dng:software: Adobe Photoshop Lightroom 4.3 (Windows)
    dng:wb.rb.levels: 0.000000 0.000000 1.000000 0.000000
    signature: c5d147b11cd399ceaed5d579d449b4ebe880981555d520ef3dd5c9c678cefde9
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 16.7995MiB
  Number pixels: 9.13003M
  Pixels per second: 7.56091MP
  User time: 1.210u
  Elapsed time: 0:02.207
  Version: ImageMagick 7.0.9-22 Q16 x86_64 2020-02-12 https://imagemagick.org
EXIF tool

Code: Select all

root@dev-storage:/work/mediahaven/tools/imagemagick# /work/mediahaven/tools/exiftool/exiftool /mnt/STORAGE/TESTSUITE/old_imagemagick_generates_bad_preview_but_must_work_OK.dng
ExifTool Version Number         : 11.76
File Name                       : old_imagemagick_generates_bad_preview_but_must_work_OK.dng
Directory                       : /mnt/STORAGE/TESTSUITE
File Size                       : 17 MB
File Modification Date/Time     : 2020:02:12 16:47:57+01:00
File Access Date/Time           : 2020:02:12 16:50:50+01:00
File Inode Change Date/Time     : 2020:02:12 16:48:57+01:00
File Permissions                : rw-r--r--
File Type                       : DNG
File Type Extension             : dng
MIME Type                       : image/x-adobe-dng
Exif Byte Order                 : Little-endian (Intel, II)
Strip Offsets                   : 12344
Orientation                     : Horizontal (normal)
Rows Per Strip                  : 182
Strip Byte Counts               : 139776
Software                        : Adobe Photoshop Lightroom 4.3 (Windows)
Modify Date                     : 2014:03:10 08:28:37
Image Width                     : 3579
Image Height                    : 2551
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : Linear Raw
Samples Per Pixel               : 3
Planar Configuration            : Chunky
Linearization Table             : (Binary data 1374 bytes, use -b option to extract)
Black Level Repeat Dim          : 1 1
Black Level                     : 0 0 0
White Level                     : 65535 65535 65535
Default Scale                   : 1 1
Default Crop Origin             : 0 0
Default Crop Size               : 3579 2551
Chroma Blur Radius              : 0
Anti Alias Strength             : 1
Best Quality Scale              : 1
Active Area                     : 0 0 2551 3579
Default User Crop               : 0 0 1 1
Preview Image Start             : 152120
Preview Image Length            : 113939
Y Cb Cr Coefficients            : 0.299 0.587 0.114
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Y Cb Cr Positioning             : Co-sited
Reference Black White           : 0 255 128 255 128 255
Jpg From Raw Start              : 266060
Jpg From Raw Length             : 1183332
Subfile Type                    : Reduced-resolution image
Tile Width                      : 256
Tile Length                     : 192
Tile Offsets                    : 2062176
Tile Byte Counts                : 13636
Opcode List 2                   : MapPolynomial, MapPolynomial, MapPolynomial
Cache Version                   : 0.1.0.0
XMP Toolkit                     : Adobe XMP Core 5.5-c002 1.148022, 2012/07/15-18:06:45
Format                          : image/dng
Creator Tool                    : Adobe Photoshop Lightroom 4.3 (Windows)
Metadata Date                   : 2014:03:10 08:28:37+01:00
Document ID                     : xmp.did:ea25dd1d-50ba-2f42-88a0-33515db86002
Instance ID                     : xmp.iid:ea25dd1d-50ba-2f42-88a0-33515db86002
Original Document ID            : uuid:74BD5C167DEFDF118838DB3886BD35CF
Color Space                     : Uncalibrated
Has Crop                        : False
History Action                  : saved, converted, derived, saved, converted, derived, saved
History Instance ID             : xmp.iid:E61AF4F568226811A5C192FEE550C4AF, xmp.iid:E71AF4F568226811A5C192FEE550C4AF, xmp.iid:ea25dd1d-50ba-2f42-88a0-33515db86002
History When                    : 2013:10:18 08:39:31+02:00, 2013:10:18 08:39:31+02:00, 2014:03:10 08:28:37+01:00
History Software Agent          : Adobe Photoshop CS4 Macintosh, Adobe Photoshop CS4 Macintosh, Adobe Photoshop Lightroom 4.3 (Windows)
History Changed                 : /, /, /
History Parameters              : from image/jpeg to application/vnd.adobe.photoshop, converted from image/jpeg to application/vnd.adobe.photoshop, from application/vnd.adobe.photoshop to image/vnd.adobe.photoshop, converted from image/vnd.adobe.photoshop to image/dng, saved to new location
Derived From Instance ID        : xmp.iid:E71AF4F568226811A5C192FEE550C4AF
Derived From Document ID        : uuid:74BD5C167DEFDF118838DB3886BD35CF
Derived From Original Document ID: uuid:74BD5C167DEFDF118838DB3886BD35CF
Exif Version                    : 0230
Create Date                     : 2010:11:14 00:24:04
DNG Version                     : 1.3.0.0
DNG Backward Version            : 1.1.0.0
Unique Camera Model             : PSD
Color Matrix 1                  : 1.9625 -0.6108 -0.3414 -0.9787 1.9161 0.0335 0.0286 -0.1407 1.349
Analog Balance                  : 1 1 1
As Shot White XY                : 0.3457 0.3585
Baseline Exposure               : 0
Baseline Noise                  : 1
Baseline Sharpness              : 1
Linear Response Limit           : 1
Shadow Scale                    : 1
Calibration Illuminant 1        : Unknown
Raw Data Unique ID              : FAC788D29F0FF59108670A18DE6D52D0
Colorimetric Reference          : 1
Profile Name                    : Embedded
Profile Embed Policy            : Allow Copying
Preview Application Name        : Adobe Photoshop Lightroom
Preview Application Version     : 4.3
Preview Settings Digest         : 2621cd669b6f62f5497e3de8a65196e0
Preview Color Space             : sRGB
Preview Date Time               : 2014:03:10 08:28:36+01:00
New Raw Image Digest            : fdc8bab377f7aa97497236d34d531698
Image Size                      : 3579x2551
Jpg From Raw                    : (Binary data 1183332 bytes, use -b option to extract)
Megapixels                      : 9.1
Preview Image                   : (Binary data 113939 bytes, use -b option to extract)
Thumbnail TIFF                  : (Binary data 139992 bytes, use -b option to extract)

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: DNG to JPG results in distorted image.

Post by fmw42 »

Post a link to your DNG file so others can check it out.

Try

Code: Select all

/bin/convert DNG:input.dng output.jpg

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: DNG to JPG results in distorted image.

Post by snibgo »

As Fred says, please post a link to the DNG file.

It is possible that IM or libraw is misreading the file. As far as I know, IM will assume a DNG file is a camera-raw file (eg a mosaiced image) but your file isn't. It contains a number of images (as DNG files often do), but the main image seems to be a demosaiced JPEG.

IM is reporting 16 bits/channel/pixel. Possibly libraw is returning that number.

EDIT to add: As a workaround, try prefixing the filename with TIFF: instead of DNG:, eg

Code: Select all

/bin/convert TIFF:input.dng output.jpg
IM will then read the file as an ordinary TIFF instead of passing it to libraw.
snibgo's IM pages: im.snibgo.com

Alexis Rombaut
Posts: 6
Joined: 2013-11-28T09:00:44-07:00
Authentication code: 6789

Re: DNG to JPG results in distorted image.

Post by Alexis Rombaut »

Thank you for you replies. Let me also thank your open source dedication which has allowed us as commercial company to offer flexible conversion of images over many years.

As requested here you can find two DNGs and the preview generated by the command convert at the following
link.

I have tried the suggestion to use prefix "TIFF:". It works but simply extracts a low res TIFF thumbnail embedded in the DNG file. Our requirement is to produce a high resolution JPEG preview from the main image in the DNG.

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: DNG to JPG results in distorted image.

Post by magick »

ImageMagick leverages libraw to read raw camera format image files. It apparently has a bug when reading your image. In the mean-time try http://darktable.org. It returns expected results.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: DNG to JPG results in distorted image.

Post by snibgo »

According to exiftool, sample_1-1.DNG has a main image 4252x2835 pixels, 3 channels/pixel, JPEG compression, photometric interpretation linear raw.

ImageMagick v7.0.8-64, using libraw, misreads the file. I resize and save to jpg just for web convenience:

Code: Select all

magick -verbose sample_1-1.DNG -resize 600x600 sample_1_IM.jpg
Image

dcraw also misreads the file:

Code: Select all

%DCRAW% -v -6 -T -O x2.tiff sample_1-1.DNG
magick x2.tiff -resize 600x600 -quality 40 sample_1-1.jpg
Image


darktable v2.6.2 (which is an old version) successfully reads the file. I think (but I'm not sure) that darktable uses its own version of libraw.


I suspect that dcraw and libraw have bugs. If so, then there is no chance of IM successfully reading the image.

A workaround may be to use some other tool, eg darktable which can be run in batch.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: DNG to JPG results in distorted image.

Post by fmw42 »

It is possible that the JPEG compression used is an old out-dated type compression that is no longer used in modern systems. Thus draw and Imagemagick will not read it properly. This is just a guess.

Alexis Rombaut
Posts: 6
Joined: 2013-11-28T09:00:44-07:00
Authentication code: 6789

Re: DNG to JPG results in distorted image.

Post by Alexis Rombaut »

Thank you for the dark table suggestion, that resolved our problem. We have changed our conversion chain for DNG by doing:
DNG -> PNG via darktable and then PNG -> JPG via IM.

Locked