https://bugs.documentfoundation.org/show_bug.cgi?id=169934

            Bug ID: 169934
           Summary: Transparency is lost when applying a duotone filter to
                    images in Excel files
           Product: LibreOffice
           Version: 26.2.0.0 alpha0+ master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Printing and PDF export
          Assignee: [email protected]
          Reporter: [email protected]

Description:
When exporting an Excel document to PDF using the command-line option
`--convert-to pdf`, images that have a duotone filter applied lose their
transparency. In the resulting PDF, the affected images appear fully opaque
instead of preserving their original transparency.


Steps to Reproduce:
1. Prepare an Excel file that contains an image with a duotone filter applied.
2. Export it using: `soffice --headless --convert-to pdf filename.xlsx`
3. Open the generated PDF.


Actual Results:
The transparency of the duotone-filtered image is lost, and the image is
rendered as fully opaque in the PDF output.

Expected Results:
Transparency should be preserved when exporting duotone-filtered images to PDF.


Reproducible: Always


User Profile Reset: No

Additional Info:
The issue appears to originate from the duotone conversion logic in
`BitmapDuoToneFilter::execute()`.
The alpha channel is not propagated to the output color, causing the resulting
bitmap to lose transparency.
A minimal fix is shown below:

diff --git a/vcl/source/bitmap/BitmapDuoToneFilter.cxx
b/vcl/source/bitmap/BitmapDuoToneFilter.cxx
index 2dd10459e242..d0bb35cf6863 100644
--- a/vcl/source/bitmap/BitmapDuoToneFilter.cxx
+++ b/vcl/source/bitmap/BitmapDuoToneFilter.cxx
@@ -41,10 +41,12 @@ Bitmap BitmapDuoToneFilter::execute(Bitmap const& rBitmap)
const
             BitmapColor aColor = pReadAcc->GetColor(y, x);
             sal_uInt8 nLuminance = aColor.GetLuminance();
             BitmapColor aResultColor(
+                ColorAlphaTag::ColorAlpha,
                 lcl_getDuotoneColorComponent(nLuminance, aColorOne.GetRed(),
aColorTwo.GetRed()),
                 lcl_getDuotoneColorComponent(nLuminance, aColorOne.GetGreen(),
                                              aColorTwo.GetGreen()),
-                lcl_getDuotoneColorComponent(nLuminance, aColorOne.GetBlue(),
aColorTwo.GetBlue()));
+                lcl_getDuotoneColorComponent(nLuminance, aColorOne.GetBlue(),
aColorTwo.GetBlue()),
+                aColor.GetAlpha());
             pWriteAcc->SetPixel(y, x, aResultColor);
         }
     }

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to