You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xmlgraphics.apache.org by watte babbu <wa...@gmail.com> on 2010/10/12 07:21:43 UTC

converting emf to png/jpg

I am trying to convert a emf file to a png or jpg file. I am
image.loader.ImageViewer to see if an emf file could be loaded in the first
place. Running the ImageViewer thorws a ImageException :
*******
org.apache.xmlgraphics.image.loader.ImageException: Cannot load image (no
suitable loader/converter combination available) for
file:/c:/ravi/image8.emf (image/emf)
    at
org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:230)
    at
org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:294)
    at image.loader.ImageViewer.display(ImageViewer.java:68)
    at image.loader.ImageViewer.main(ImageViewer.java:133)
**********
The line where it throwes this exception is
******
            ImageInfo info = this.imageManager.getImageInfo(uri,
sessionContext);
            //Load image and request Graphics2D image

            g2dImage = (ImageGraphics2D)this.imageManager.getImage(info,
ImageFlavor.BUFFERED_IMAGE, sessionContext); //throws the exception on this
line.
******
Looks like ImageMagager could not find a ImageProviderPipeline in this line
in ImageMagager.
ImageProviderPipeline pipeline =
getPipelineFactory().newImageConverterPipeline(info, flavor);

Is loading an EMF image supported?. The documentation says that EMF
ImageLoader is supported out of the box. Please suggest what am I doing
wrong.
Thanks,
-Watte.

Re: converting emf to png/jpg

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
RTF is an older text document file format:
http://en.wikipedia.org/wiki/Rich_Text_Format

FOP can convert XSL-FO to RTF, and because RTF supports EMF as image
format, I've added a loader plug-in for EMF to be embedded. But we can't
interpret EMF at all. The RTF support of FOP won't help you if all you
need is to get an EMF as a bitmap image.

Maybe you should consider writing a C#, VB or C++ component/application
that calls Windows' EMF infrastructure to render these files as bitmaps.
It's very easy there. You'll probably even find such components on the
net already. How you integrate that in your application is a different
question if you're working with Java as your primary language. Choices:
REST, SOAP, JNI etc. etc. Anyway, I can't help you with that.

On 12.10.2010 08:21:40 watte babbu wrote:
> Hi Jeremias,
> What is RTF's output format. Is there a sample I can use to see what if
> produces.
> I need to convert emf files in the server to some format that the browsers
> can understand.
> Thanks,
> -Watte.
> 
> On Mon, Oct 11, 2010 at 11:18 PM, Jeremias Maerki <de...@jeremias-maerki.ch>wrote:
> 
> > Watte,
> > I'm sorry that the documentation has mislead you. EMF support is
> > currently restricted to format detection. Only Apache FOP's RTF output
> > has support for embedding EMF files (and that's the only reason some
> > level of EMF support exists). Other than that there is currently no
> > support for EMF.
> >
> > Apache FOP contains an image converter plug-in that can convert WMF to
> > graphics using Batik's WMF classes. But that's it.
> >
> > On 12.10.2010 07:21:43 watte babbu wrote:
> > > I am trying to convert a emf file to a png or jpg file. I am
> > > image.loader.ImageViewer to see if an emf file could be loaded in the
> > first
> > > place. Running the ImageViewer thorws a ImageException :
> > > *******
> > > org.apache.xmlgraphics.image.loader.ImageException: Cannot load image (no
> > > suitable loader/converter combination available) for
> > > file:/c:/ravi/image8.emf (image/emf)
> > >     at
> > >
> > org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:230)
> > >     at
> > >
> > org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:294)
> > >     at image.loader.ImageViewer.display(ImageViewer.java:68)
> > >     at image.loader.ImageViewer.main(ImageViewer.java:133)
> > > **********
> > > The line where it throwes this exception is
> > > ******
> > >             ImageInfo info = this.imageManager.getImageInfo(uri,
> > > sessionContext);
> > >             //Load image and request Graphics2D image
> > >
> > >             g2dImage = (ImageGraphics2D)this.imageManager.getImage(info,
> > > ImageFlavor.BUFFERED_IMAGE, sessionContext); //throws the exception on
> > this
> > > line.
> > > ******
> > > Looks like ImageMagager could not find a ImageProviderPipeline in this
> > line
> > > in ImageMagager.
> > > ImageProviderPipeline pipeline =
> > > getPipelineFactory().newImageConverterPipeline(info, flavor);
> > >
> > > Is loading an EMF image supported?. The documentation says that EMF
> > > ImageLoader is supported out of the box. Please suggest what am I doing
> > > wrong.
> > > Thanks,
> > > -Watte.
> >
> >
> >
> >
> > Jeremias Maerki
> >
> >




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Re: converting emf to png/jpg

Posted by watte babbu <wa...@gmail.com>.
Hi Jeremias,
What is RTF's output format. Is there a sample I can use to see what if
produces.
I need to convert emf files in the server to some format that the browsers
can understand.
Thanks,
-Watte.

On Mon, Oct 11, 2010 at 11:18 PM, Jeremias Maerki <de...@jeremias-maerki.ch>wrote:

> Watte,
> I'm sorry that the documentation has mislead you. EMF support is
> currently restricted to format detection. Only Apache FOP's RTF output
> has support for embedding EMF files (and that's the only reason some
> level of EMF support exists). Other than that there is currently no
> support for EMF.
>
> Apache FOP contains an image converter plug-in that can convert WMF to
> graphics using Batik's WMF classes. But that's it.
>
> On 12.10.2010 07:21:43 watte babbu wrote:
> > I am trying to convert a emf file to a png or jpg file. I am
> > image.loader.ImageViewer to see if an emf file could be loaded in the
> first
> > place. Running the ImageViewer thorws a ImageException :
> > *******
> > org.apache.xmlgraphics.image.loader.ImageException: Cannot load image (no
> > suitable loader/converter combination available) for
> > file:/c:/ravi/image8.emf (image/emf)
> >     at
> >
> org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:230)
> >     at
> >
> org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:294)
> >     at image.loader.ImageViewer.display(ImageViewer.java:68)
> >     at image.loader.ImageViewer.main(ImageViewer.java:133)
> > **********
> > The line where it throwes this exception is
> > ******
> >             ImageInfo info = this.imageManager.getImageInfo(uri,
> > sessionContext);
> >             //Load image and request Graphics2D image
> >
> >             g2dImage = (ImageGraphics2D)this.imageManager.getImage(info,
> > ImageFlavor.BUFFERED_IMAGE, sessionContext); //throws the exception on
> this
> > line.
> > ******
> > Looks like ImageMagager could not find a ImageProviderPipeline in this
> line
> > in ImageMagager.
> > ImageProviderPipeline pipeline =
> > getPipelineFactory().newImageConverterPipeline(info, flavor);
> >
> > Is loading an EMF image supported?. The documentation says that EMF
> > ImageLoader is supported out of the box. Please suggest what am I doing
> > wrong.
> > Thanks,
> > -Watte.
>
>
>
>
> Jeremias Maerki
>
>

Re: converting emf to png/jpg

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Watte,
I'm sorry that the documentation has mislead you. EMF support is
currently restricted to format detection. Only Apache FOP's RTF output
has support for embedding EMF files (and that's the only reason some
level of EMF support exists). Other than that there is currently no
support for EMF.

Apache FOP contains an image converter plug-in that can convert WMF to
graphics using Batik's WMF classes. But that's it.

On 12.10.2010 07:21:43 watte babbu wrote:
> I am trying to convert a emf file to a png or jpg file. I am
> image.loader.ImageViewer to see if an emf file could be loaded in the first
> place. Running the ImageViewer thorws a ImageException :
> *******
> org.apache.xmlgraphics.image.loader.ImageException: Cannot load image (no
> suitable loader/converter combination available) for
> file:/c:/ravi/image8.emf (image/emf)
>     at
> org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:230)
>     at
> org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:294)
>     at image.loader.ImageViewer.display(ImageViewer.java:68)
>     at image.loader.ImageViewer.main(ImageViewer.java:133)
> **********
> The line where it throwes this exception is
> ******
>             ImageInfo info = this.imageManager.getImageInfo(uri,
> sessionContext);
>             //Load image and request Graphics2D image
> 
>             g2dImage = (ImageGraphics2D)this.imageManager.getImage(info,
> ImageFlavor.BUFFERED_IMAGE, sessionContext); //throws the exception on this
> line.
> ******
> Looks like ImageMagager could not find a ImageProviderPipeline in this line
> in ImageMagager.
> ImageProviderPipeline pipeline =
> getPipelineFactory().newImageConverterPipeline(info, flavor);
> 
> Is loading an EMF image supported?. The documentation says that EMF
> ImageLoader is supported out of the box. Please suggest what am I doing
> wrong.
> Thanks,
> -Watte.




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org