Bug 38289 - Image extractor for PPT files
Summary: Image extractor for PPT files
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-16 16:41 UTC by Yegor Kozlov
Modified: 2006-01-16 10:28 UTC (History)
0 users



Attachments
java sources (17.35 KB, application/octet-stream)
2006-01-16 16:43 UTC, Yegor Kozlov
Details
changes for image extractor (2.81 KB, patch)
2006-01-16 16:43 UTC, Yegor Kozlov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yegor Kozlov 2006-01-16 16:41:58 UTC
Initial version of image extractor for PPT files. Only JPEG and PNG formats are 
supported.
Comment 1 Yegor Kozlov 2006-01-16 16:43:14 UTC
Created attachment 17435 [details]
java sources
Comment 2 Yegor Kozlov 2006-01-16 16:43:57 UTC
Created attachment 17436 [details]
changes for image extractor
Comment 3 Yegor Kozlov 2006-01-16 16:48:16 UTC
I commited the first version of an image extractor for powerpoint files.

The following fragemnt of code demonstrates how to extract png images from a 
ppt and save them as files:

        HSLFSlideShow ppt = new HSLFSlideShow(pptfile);
        Picture[] pict = ppt.getPictures();
        for (int i = 0; i < pict.length; i++) {
            byte[] data = pict[i].getData();
            int type = pict[i].getType();
            if (type == Pictures.PNG) {
               FileOutputStream out = new FileOutputStream("pict_"+i+".png");
               out.write(data);  
               out.close();  
            }
        }
        ppt.close();

Enjoy.

Best Regards, Yegor
Comment 4 Nick Burch 2006-01-16 16:59:47 UTC
Thanks. I'll try to take a look through this tonight, and then commit
Comment 5 Nick Burch 2006-01-16 19:28:29 UTC
Thanks for this code, it looks great. I've committed it