poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 60406] New: Image extensions getting altered.
Date Wed, 23 Nov 2016 06:38:42 GMT

            Bug ID: 60406
           Summary: Image extensions getting altered.
           Product: POI
           Version: 3.15-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: subhrajlahiri@gmail.com
  Target Milestone: ---

Created attachment 34468
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34468&action=edit
Added the output snapshot which validates the bug.

I am using Apache POI library to extract images from a word(docx) file. The
issue that I am facing is regarding extension(image type) extraction and is
described as follows:
   * I am getting wrong extension for images(embedded via insert object from
insert tab).
   * When the image is embedded via drag and drop then the extension is
perfectly extracted

Steps to reproduce :
1. Create a docx file with two images embedded to it.
   a. Embed first image (assume it to be 1.jpeg) via (Insert Tab -> Insert
Object -> Create from file -> Add object).
   b. Embed second image (assume it to be 2.png) via drag and dropping in the
word file.

2. Create a java program which accepts the file created and processes the file
and extracts the image file and shows the "image type" and "name" in the

Expected Result:
5 => //Document.PICTURE_TYPE_JPEG = 5
6 => //Document.PICTURE_TYPE_PNG = 6

Current Result:
2 => //Document.PICTURE_TYPE_EMF = 2
6 => //Document.PICTURE_TYPE_PNG = 6

Code used for extracting the image information:

InputStream content = null;   
content = new BufferedInputStream(new FileInputStream(filePath));
XWPFDocument doc = new XWPFDocument(content);
List<XWPFPictureData> pics = doc.getAllPictures();
for(XWPFPictureData pic : pics)

You are receiving this mail because:
You are the assignee for the bug.
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message