Picture Fill Slide Background Is Not Showing Correct Color

Hi,

I am using “Circuit” theme for the attached PPTX file which has a picture fill and a dark grey background style. When I create a Aspose.Slides.Presentation using this PPTX file and look at the effective background it generates, it does not show the background color (dark grey). I have attached the background image for your reference.
slide.zip (1.7 MB)

Kindly help resolving this issue. Thanks,

Bhavana

I have noticed this behavior with other such similar themes as well which have picture fill. As an example, pls find attached a sample.pptx with “Ion” Theme which produces gray background image - image.jpg (obtained by using Aspose.Slides.Background.GetEffective()).
example2.zip (1.2 MB)

@bhav,
Thank you for contacting free support.

I am not sure I understand the problem you are facing. Could you please share a code example and describe the expected result?

Hi Andrey,

Sure, let me try explaining with an example. If you unzip
example2.zip (1.2 MB)
you will find sample.pptx in it. This file is the input to the following code. Lets us assume that this file is kept at m_szPptxPath path.

//Create a Presentation from sample.pptx file
Presentation m_Presentation = new Presentation(m_szPptxPath);

//Get effective background 
 IBackgroundEffectiveData effectiveBackground = m_Presentation.Slides[0].Background.GetEffective();

//Get the image used for the background and save it to image.jpg
System.Drawing.Image systemImage = effectiveBackground.FillFormat.PictureFillFormat.Picture.Image.SystemImage;
systemImage.Save("C:\\image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

The background in sample.pptx does not match the background image.jpg obtained from Aspose. The color is not the same. Hope this explains the problem. Pls let me know if you need further details.

PS: You will find image.jpg too in the zip.

Thanks,
Bhavana

@bhav,
Thank you for the details. I need some time to check the issue. I will get back to you soon.

@bhav,
Thank you for your patience. Aspose.Slides returns the correct image. You can verify this in the following way:

  1. Rename the PPTX file to sample.zip.
  2. Go to the folder sample.zip/ppt/media/.
  3. Open the image image1.jpeg.

Please note that you can extract the theme color like this:

IMasterSlide masterSlide = m_Presentation.Slides[0].LayoutSlide.MasterSlide;
IColorFormat colorFormat = masterSlide.Background.StyleColor;

More examples: Presentation Theme|Aspose.Slides Documentation

Hi Andrey,

Thank you for your response.

I followed the steps and checked image1.jpeg. It is the same image which I see as the effective background image returned from Aspose. But, this image does not capture the theme color. I also tried the two lines given below:

IMasterSlide masterSlide = m_Presentation.Slides[0].LayoutSlide.MasterSlide;
IColorFormat colorFormat = masterSlide.Background.StyleColor;

I do get the theme color from it. Aspose does not seem to take this color into account while determining the effective background image of a slide. How can I get the right background color for the slide image ? Do I need to do any post processing on the effective background image provided by Aspose and the theme color obtained from masterSlide.Background.StyleColor? Pls advise. Thanks

Bhavana

@bhav,
If I understand correctly, you would like to extract the final background applied to slides as an image. Could you please confirm?

Please note that some shapes may be added when a theme is applied to the presentation: ion_theme.jpg (86.7 KB). Do your requirements include having such shapes in the final background image?

Hello Andrey,

Yes, I need to extract the final background applied to slides as an image.

Yes, my requirements include having such shapes in the final background image.

Bhavana

@bhav,
Thank you for the confirmation.

We have opened the following new ticket(s) in our internal issue tracking system and will implement such a feature according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-44833

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you for the response Andrey.

@bhav,
Thank you for using Aspose.Slides.

@bhav,
We looked through your requirements. Please try using the following code example:

int slideIndex = 0;
int imageScale = 1;

using (Presentation presentation = new Presentation("sample.pptx"))
{
    SizeF slideSize = presentation.SlideSize.Size;
    ISlide slide = presentation.Slides[slideIndex];

    using (Presentation tempPresentation = new Presentation())
    {
        tempPresentation.SlideSize.SetSize(slideSize.Width, slideSize.Height, SlideSizeScaleType.DoNotScale);

        ISlide clonedSlide = tempPresentation.Slides.AddClone(slide);
        clonedSlide.Shapes.Clear();

        using (IImage background = clonedSlide.GetImage(imageScale, imageScale))
        {
            background.Save("output.png", ImageFormat.Png);
        }
    }
}

Documentation:
Get the Entire Presentation Slide Background as an Image|Aspose.Slides Documentation