The glow effect is barely visible for glow radius value between 1 and 3 in the thumbnail. This significantly differs from the Powerpoint file where you see a clear glow effect in that range. With glow radius 4 and higher, the glow effect is clearly visible in the thumbnail.
Expected behavior: The glow effect in the thumbnail looks the same as it does in the PPTX file.
Tested with Aspose Slides 23.11.
GlowEffectThicknessInThumbnail.png (70.1 KB)
Here is a short Java 17 program to reproduce the behavior.
import com.aspose.slides.*;
import javax.imageio.ImageIO;
import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
@SuppressWarnings("CallToPrintStackTrace")
public class GlowEffectThickness {
public static void main(String[] args) {
final var presentation = new Presentation();
final var slide = presentation.getSlides().get_Item(0);
for (int glowRadius = 0; glowRadius < 7; glowRadius++) {
addRectangle(slide, glowRadius);
}
writeFile("GlowEffectThicknessInThumbnail.png",
outputStream -> ImageIO.write(slide.getThumbnail(2, 2), "png", outputStream));
writeFile("GlowEffectThicknessInThumbnail.pptx",
outputStream -> presentation.save(outputStream, SaveFormat.Pptx));
}
private static void addRectangle(final ISlide slide, final int glowRadius) {
final var bgColor = Color.white;
final var fgColor = new Color(0x808080);
final var glowColor = new Color(0xaa0000);
final var shape = slide.getShapes().addAutoShape(ShapeType.Rectangle,
280, 135 + glowRadius * 40, 160, 30);
shape.getTextFrame().getTextFrameFormat().setWrapText(NullableBool.False);
shape.getTextFrame().setText("Glow radius: " + glowRadius);
streamTextFramePortions(shape.getTextFrame())
.map(portion -> portion.getPortionFormat().getFillFormat())
.forEach(fillFormat -> {
fillFormat.setFillType(FillType.Solid);
fillFormat.getSolidFillColor().setColor(fgColor);
});
shape.getLineFormat().getFillFormat().setFillType(FillType.Solid);
shape.getLineFormat().getFillFormat().getSolidFillColor().setColor(fgColor);
shape.getLineFormat().setWidth(1);
shape.getFillFormat().setFillType(FillType.Solid);
shape.getFillFormat().getSolidFillColor().setColor(bgColor);
shape.getEffectFormat().enableGlowEffect();
shape.getEffectFormat().getGlowEffect().setRadius(glowRadius);
shape.getEffectFormat().getGlowEffect().getColor().setColor(glowColor);
}
private static Stream<IPortion> streamTextFramePortions(ITextFrame textFrame) {
return StreamSupport.stream(textFrame.getParagraphs().spliterator(), false)
.flatMap(paragraph -> StreamSupport.stream(paragraph.getPortions().spliterator(), false));
}
private static void writeFile(String fileName, FileWriter fileWriter) {
final File pngFile = new File(fileName);
try (final FileOutputStream outputStream = new FileOutputStream(pngFile)) {
System.out.println("Writing file " + pngFile.getAbsolutePath());
fileWriter.write(outputStream);
} catch (final IOException e) {
e.printStackTrace();
}
}
@FunctionalInterface
public interface FileWriter {
void write(FileOutputStream fileOutputStream) throws IOException;
}
}