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

Free Support Forum - aspose.com

Getting Duotone Effective Throws InvalidOperationException

Please view the following picture.
Duotone.png (51.1 KB)
This is my demo file, I think the exception is reproducible.
DuotoneEffect.pptx.zip (712.9 KB)
System: macOs 11.4
Version: 21.6

@oscarstar

Can you please share the working sample code used to reproduce the issue.

Please unzip the file and run the following code.
presentation = new Presentation(“DuotoneEffect.pptx”);
Color color1 = ((Duotone)((PictureFrame)presentation.getSlides().get_Item(0).getShapes().get_Item(0)).getPictureFormat().getPicture().getImageTransform().get_Item(0)).getEffective().getColor1();
The “Color is not resolved yet.” exception will be thrown.
I found the value of Duotone.getColor1() seems to be wrong.Could not use the value of color1 and color2 to add the same effect to the origin image in any way.so I think should use the value of getEffective().

@oscarstar

Can you please highlight in the PowerPoint that what color you are trying to access in presentation?

duotone issue.pptx.zip (579.9 KB)
snapshot.jpg (474.6 KB)
Please review the snapshot and the attach file.I get the value of color1 and color2 like the snapshot.I use the value to process the origin picture in css. I can never render the same effect like ppt, no matter how hard I try.I suspect the value of color1 and color2 could be wrong.
Any help would be grateful.

@oscarstar

I have created a ticket with ID SLIDESJAVA-38575 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

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

@oscarstar,
With Aspose.Slides 21.9, please use the following code snippet:

Presentation pres = new Presentation("DuotoneEffect 2.pptx");

IDuotone duotone = (IDuotone)((PictureFrame)pres.getSlides().get_Item(0).getShapes().get_Item(0)).getPictureFormat().getPicture().getImageTransform().get_Item(0);
IDuotoneEffectiveData effectiveDuotone = duotone.getEffective();

System.out.println(effectiveDuotone.getColor1().toString());
System.out.println(effectiveDuotone.getColor2().toString());

Output:

java.awt.Color[r=0,g=0,b=0]
java.awt.Color[r=179,g=229,b=255]

Thanks a lot. I will try to rewrite the code to solve the problem.