We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Blue square instead of pics when saving as Tiff

Hello,

We got the following problems using aspose slides 4.4.0 and 5.2.0

We inserted a picture in a presentation (.pptx) using code sample and tried to save the presentation as tiff image. Randomly, instead of the picture a blue square appears (with the dimensions of the picture).

The problem does not appear if we use a .pptx presentation that already contains an image inside. We don't see any issue if we try to save under another format than tiff (pdf and pptx works fine)

Here is the code we used:

//Sets the shape as image container
shape.FillFormat.FillType = FillTypeEx.Picture;
shape.FillFormat.PictureFillFormat.PictureFillMode = PictureFillModeEx.Stretch;

System.Drawing.Image img = pEdition.imgBmp; // pEdition.imgBmp being a Bitmap object
ImageEx imgx = pres.Images.AddImage(img);
shape.FillFormat.PictureFillFormat.Picture.Image = imgx;

//Saving document
pres.Save(Server.MapPath(Params.DirTombstones) + "\\result.pdf", Aspose.Slides.Export.SaveFormat.Pdf);
pres.Save(Params.ImagesParentDirectory + Params.DirTombstones + "result.tiff", SaveFormat.Tiff, to);

Would you have any idea why this occurs? And any idea to fix it?

Thanks a lot for your help!

Hi Michel,<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

Thanks for your interest in
Aspose.Slides.<o:p></o:p>

I have worked with the scenario
shared by you and have been able to observe the issue specified. Actually, PictureFillModeEx.Tile property does not seem to
work at the moment for the shape. An issue with ID28934 has been added
in our issue tracking system to further investigate and resolve the issue.
However, at the moment you may please try using following statement and there
will be no issue hopefully.

//Instantiate
PrseetationEx class that represents the PPTX

PresentationEx pres = new PresentationEx();

//Get the first slide

SlideEx sld = pres.Slides[0];

//Add autoshape of
rectangle type

int idx = sld.Shapes.AddAutoShape(ShapeTypeEx.Rectangle,
50, 150, 75, 150);

ShapeEx shp = sld.Shapes[idx];

//Set the picture

System.Drawing.Image img = (System.Drawing.Image)new Bitmap(“d:\Aspose
Data\Desert.jpg”
);

ImageEx imgx = pres.Images.AddImage(img);

shp.FillFormat.PictureFillFormat.Picture.Image
= imgx;

//Set the fill type to
Picture

shp.FillFormat.FillType = FillTypeEx.Picture;

shp.FillFormat.PictureFillFormat.PictureFillMode
= PictureFillModeEx.Stretch;

//
shp.FillFormat.PictureFillFormat.Picture.Image = imgx;

//Write the PPTX file to
disk

pres.Write(“d:\RectShpPic.pptx”);

pres.Save(“d:\RectShpPic.tiff”,
Aspose.Slides.Export.SaveFormat.Tiff);

Thanks
and Regards,

Hello,

Thank you for your quick answer. actually we are already using the PictureFillModeEx.Stretch mode and we need to keep this for our project. It still does make the same problem. I don't really see any difference betwwen your sample of code and the one we are using, so if you see any, i'd be glad to discover what went wrong.

Thanks again for your help!

Hi Michel,

I have re-tested the code with Aspose.Slides for .NET 5.2.0 and it worked on my end. It will be really nice if you may please share the project code including the Aspose.Slides dll with me for further investigation.

Thanks and Regards,

Hi,


I made other tests, using exactly the code from the documentation and still getting the same trouble saving the files.

Here is the method called:

public void TestImageAsposePPTX()
{
//Instantiate PrseetationEx class that represents the PPTX
PresentationEx pres = new PresentationEx();

//Get the first slide
SlideEx sld = pres.Slides[0];

//Add autoshape of rectangle type
int idx = sld.Shapes.AddAutoShape(ShapeTypeEx.Rectangle, 50, 150, 75, 150);
ShapeEx shp = sld.Shapes[idx];

//Set the fill type to Picture
shp.FillFormat.FillType = FillTypeEx.Picture;

//Set the picture fill mode
shp.FillFormat.PictureFillFormat.PictureFillMode = PictureFillModeEx.Tile;

//Set the picture
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(“c:\pptx\images.jpg”);
ImageEx imgx = pres.Images.AddImage(img);
shp.FillFormat.PictureFillFormat.Picture.Image = imgx;

//Write the PPTX file to disk
pres.Write(“c:\pptx\RectShpPic.pptx”);
pres.Save(@“C:\pptx\result.pdf”, Aspose.Slides.Export.SaveFormat.Pdf);
pres.Save(@“C:\pptx\result.tiff”, SaveFormat.Tiff);
}

And in attached files the result i get. Version used: 5.2.0.0 (seen in the dll properties).

Thanks a lot for your help.

Hi Michel,

I have used Aspose.Slides for .NET 5.4.0 for my investigation and have been able to observe the shape background image in Tiff image. However, the generated PDF has not shape background image and I have updated the status of issue ID 28934. We will share further information with you once the issue is resolved. You may please try using Aspose.Slides for .NET. For your kind reference, I have shared generated presentation and Tiff image.

Thanks and Regards,

The issues you have found earlier (filed as SLIDESNET-28934) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.