poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re: WMF Pictures
Date Wed, 02 Aug 2006 06:34:03 GMT
WMF pictures are not supported yet. Only JPEG and PNG can be
extracted.

 WMF it is stored compressed, i.e. PictureData.getData() returns you the
 compressed data, not the raw WMF bytes. I'm not sure if it can be
 unpacked using the standard java.util.zip.InflaterInputStream. I made
 a few unsuccessful attempts :).

I hope later I will implement all supported image formats: EMF, WMF, PICT,
JPEG, PNG and DIB. Just need time for it :).

Regards, Yegor

mj> Hi,

mj> I´m trying to retrieve the pictures from a PPT File, and I'm having trouble
mj> getting WMF and EMF pictures. Is there anyway to get these? Where I´m wrong?

mj> Here´s the code:

mj> Slide s2 = s[i];
mj> Shape[] sh = s2.getShapes();
mj>         for (int j = 0; j < sh.length; j++)
mj>         {
mj>             if (sh[j] instanceof Picture)
mj>             {
mj>                 pics++;
mj>                 Picture p = (Picture)sh[j];
mj>                 int type = p.getPictureData().getType();
mj>                 byte[] data = p.getPictureData().getData();
mj>                 if (type == Picture.JPEG)
mj>                 {
mj>                     FileOutputStream out = new
mj> FileOutputStream("pict"+j+".jpg");
mj>                     out.write(data);
mj>                     out.close();
mj>                     System.out.println("Imagem criada: "+"pict"+j+".jpg");
mj>                 }
mj>                 else if(type == Picture.PNG)
mj>                 {
mj>                     FileOutputStream out = new
mj> FileOutputStream("pict"+j+".png");
mj>                     out.write(data);
mj>                     out.close();
mj>                     System.out.println("Imagem criada: "+"pict"+j+".png");
mj>                 }
mj>                 else //In this case i will try to get the WMF and other
mj> formats
mj>                 {
mj>                     FileOutputStream out = new
mj> FileOutputStream("pict"+j+".wmf");
mj>                     out.write(data);
mj>                     out.close();
mj>                     System.out.println("Imagem criada: "+"pict"+j+".wmf");
mj>                 }
mj>             }


mj> Thanx,
mj> Luis.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message