Transparent error changed to Opaque picture


Mac OS 10.14.4
java version “1.8.0_181”
Java™ SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot™ 64-Bit Server VM (build 25.181-b13, mixed mode)
Aspose: aspose-cells-19.7

Read Images From orignal Excel File, then New excel file and add images to sheet
The images from orignal files are translucent, but after added to new file ,they become opaque (283.1 KB)

public class ImageInfo implements Serializable {
   private int index;
   private String name;
   private boolean hidden;
   private int zPosition;
   private byte[] data;
   private float[] position;

   public int getIndex() {
      return index;

   public void setIndex(int index) {
      this.index = index;

   public boolean isHidden() {
       return hidden;

  public void setHidden(boolean hidden) {
       this.hidden = hidden;

  public String getName() {
       return name;

  public void setName(String name) { = name;

  public byte[] getData() {
      return data;

  public void setData(byte[] data) { = data;

  public float[] getPosition() {
      return position;

  public void setPosition(float[] position) {
      this.position = position;

  public int getzPosition() {
      return zPosition;

  public void setzPosition(int zPosition) {
      this.zPosition = zPosition;

Read File

Workbook workbook = new Workbook(****FilePath****);
WorksheetCollection sheetCollection = workbook.getWorksheets();
Worksheet worksheet = sheetCollection.get(0);
ArrayList<ImageInfo> imageInfos = new ArrayList<>();
PictureCollection pictureCollection = worksheet.getPictures();
int pictureCount = pictureCollection.getCount();
for (int picIndex = 0; picIndex < pictureCount; picIndex++) {
      Picture picture = pictureCollection.get(picIndex);
      ImageInfo imageInfo = new ImageInfo();
      float left = picture.getLeftToCorner();
      float top = picture.getTopToCorner();
      float width = picture.getWidth();
      float height = picture.getHeight();
      imageInfo.setPosition(new float[]{top, left, width, height});

Export File
Write Images to New Excel

   Workbook workbook = new Workbook();
   WorksheetCollection worksheets = workbook.getWorksheets();
   Worksheet worksheet = worksheets.get(0);
   for (ImageInfo imageInfo : imageInfos) {
        int index = worksheet.getPictures().add(1, 1, new ByteArrayInputStream(imageInfo.getData()));
        Picture picture = worksheet.getPictures().get(index);
        if (imageInfo.getName()!=null){
       picture.setTopToCorner((int) imageInfo.getPosition()[0]);
       picture.setLeftToCorner((int) imageInfo.getPosition()[1]);
       picture.setWidth((int) imageInfo.getPosition()[2]);
       picture.setHeight((int) imageInfo.getPosition()[3]);


We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42980 – Transparent image changes to opaque during picture copy


thanks, i also found that they can somethime be switched by set transparent color in wps
1565762902454.jpg (474.6 KB)


Thank you for the additional information. We will consider it while analysing this issue.



Please set the FormatPicture.TransparentColor of the shape:
Sample code:

CellsColor color = workbook.createCellsColor();

And we will provide you fix soon, then you can simply use ShapeCollection.addCopy() to copy the shape from other file.


The issues you have found earlier (filed as CELLSJAVA-42980) have been fixed in Aspose.Cells for Java v19.8. This message was posted using BugNotificationTool from Downloads module by ahsaniqbalsidiqui