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
https://bz.apache.org/bugzilla/show_bug.cgi?id=60406

            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.

Description:
============
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
console.

Expected Result:
=================
5 => //Document.PICTURE_TYPE_JPEG = 5
image1.jpeg
6 => //Document.PICTURE_TYPE_PNG = 6
image2.png

Current Result:
================
2 => //Document.PICTURE_TYPE_EMF = 2
image1.emf
6 => //Document.PICTURE_TYPE_PNG = 6
image2.png


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)
{
     System.out.println(pic.getPictureType());
     System.out.println(pic.getFileName());
}

-- 
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


Mime
View raw message