@@ -6800,10 +6800,44 @@ static bool TryReadMetadataNative(LPCWSTR filePath, CImageLoader::ImageMetadata*
68006800
68016801 bool success = false ;
68026802 if (jpeg_read_header (&cinfo, TRUE ) == JPEG_HEADER_OK) {
6803+ pMetadata->Format = L" JPEG" ;
68036804 // [v10.0] Fix: Always extract dimensions natively to prevent WIC 2633px preview regression
68046805 pMetadata->Width = cinfo.image_width ;
68056806 pMetadata->Height = cinfo.image_height ;
68066807
6808+ // Fill JPEG format details even when there is no EXIF, so the Info Panel can show chroma/Q/progressive.
6809+ {
6810+ int q = GetJpegQualityFromBuffer (header.data (), header.size ());
6811+
6812+ std::wstring sub;
6813+ if (cinfo.num_components == 3 ) {
6814+ int h0 = cinfo.comp_info [0 ].h_samp_factor ;
6815+ int v0 = cinfo.comp_info [0 ].v_samp_factor ;
6816+ int h1 = cinfo.comp_info [1 ].h_samp_factor ;
6817+ int v1 = cinfo.comp_info [1 ].v_samp_factor ;
6818+ int h2 = cinfo.comp_info [2 ].h_samp_factor ;
6819+ int v2 = cinfo.comp_info [2 ].v_samp_factor ;
6820+
6821+ if (h0 == 2 && v0 == 2 && h1 == 1 && v1 == 1 && h2 == 1 && v2 == 1 ) sub = L" 4:2:0" ;
6822+ else if (h0 == 2 && v0 == 1 && h1 == 1 && v1 == 1 && h2 == 1 && v2 == 1 ) sub = L" 4:2:2" ;
6823+ else if (h0 == 1 && v0 == 1 && h1 == 1 && v1 == 1 && h2 == 1 && v2 == 1 ) sub = L" 4:4:4" ;
6824+ else sub = L" 4:4:0" ;
6825+ } else if (cinfo.num_components == 1 ) {
6826+ sub = L" Gray" ;
6827+ }
6828+
6829+ wchar_t fmtBuf[64 ]{};
6830+ if (q > 0 && !sub.empty ()) swprintf_s (fmtBuf, L" %s Q=%d" , sub.c_str (), q);
6831+ else if (q > 0 ) swprintf_s (fmtBuf, L" Q=%d" , q);
6832+ else if (!sub.empty ()) swprintf_s (fmtBuf, L" %s" , sub.c_str ());
6833+
6834+ pMetadata->FormatDetails = fmtBuf;
6835+ if (jpeg_has_multiple_scans (&cinfo)) {
6836+ if (!pMetadata->FormatDetails .empty ()) pMetadata->FormatDetails += L" " ;
6837+ pMetadata->FormatDetails += L" Prog" ;
6838+ }
6839+ }
6840+
68076841 std::vector<uint8_t > iccData;
68086842
68096843 for (jpeg_saved_marker_ptr marker = cinfo.marker_list ; marker; marker = marker->next ) {
@@ -6828,7 +6862,7 @@ static bool TryReadMetadataNative(LPCWSTR filePath, CImageLoader::ImageMetadata*
68286862 }
68296863 }
68306864 jpeg_destroy_decompress (&cinfo);
6831- return success;
6865+ return success || !pMetadata-> FormatDetails . empty () || pMetadata-> Width > 0 ;
68326866 }
68336867
68346868 // 2. WebP
0 commit comments