Picture handling


#1

Hi,

I have a problem. I need to be able to extract all picture from a presentation. Then I manipulate them with a Component that add special effect to the picture, and finally I need to replace the original picture with the modified one.

So far i’ve been able to extract picture, apply my special effect to it. But I dont know how to replace de old one with the new one :


foreach(Aspose.PowerPoint.Picture pic in pres.Pictures)

{

//Convert to Special Effect Component Image Format

MemoryStream inStream = new MemoryStream();

pic.Image.Save(inStream, pic.ImageFormat);

fx.Open(inStream);

inStream.Close();
//Special Effects

fx.ApplyEffects();
//Save file back to stream

MemoryStream outStream = new MemoryStream();

fx.Save(outStream);
//Create a System.Drawing.Image

pic.image = System.Drawing.Image.FromStream(outStream); // DONT WORK !!!

outStream.Close();}




In fact my pic (Aspose.Powerpoint.Picure) Image is read only property. So I’m not able to save the modified picture…

Is there a way to do that? Did I miss something obvious?

Thx

Alkar Durecht
Sersoft SA

#2

Dear Alkar,

It’s not possible to replace picture.
You have to add new picture and after that iterate through all shapes and replace old picture id with new one (FillFormat.PictureId and PictureFrame.PictureId).

I can implement replacing pictures but can’t guarantee correct work in some cases.