jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Convert SWF to jpg/jpeg/bmp/png Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Convert SWF to jpg/jpeg/bmp/png" Watch "Convert SWF to jpg/jpeg/bmp/png" New topic

Convert SWF to jpg/jpeg/bmp/png

Sharad Kharya
Ranch Hand

Joined: Oct 15, 2008
Posts: 68

I am working on application to convert images from one format to another.
I successfully worked for jpg, jpeg, png & bmp using "javax.imageio.ImageIO" package.

But still i stucked while converting swf to jpg.
If some one help me out to convert swf file to any of the above format. This will be great.

Note - My swf file doesn't having any moving pictures. It cantains only one image i.e just like any othjet bmp or jpeg file holds.

pseudo code to convert jpg/bmp/png to each other formats.

Thanks In Advance
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

As far as I am aware this can't be done in Java - SWF is after all not an image, its something loaded and run by Flash Player. You'll need to do something like export it in ActionScript to a standard format and load that into Java, or use the Robot class to capture the whole screen and convert that.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
If it's just a single image then Paul's suggestion of using the Robot class is probably easiest.

The JMF and Quicktime for Java libraries can play some Flash files; maybe their API allows to extract individual images.
Sharad Kharya
Ranch Hand

Joined: Oct 15, 2008
Posts: 68
Could you please keep more high light on your information.

I am going through "java.awt.Robot", there an API "createScreenCapture(Rectangle screenRect)" seems like i need to open that swf then it will take an image and convert it.
My scenario is - my SWF file is in local directory. with out opening that file i need to convert it to other format.
I seems to be an tough task...but i needs to work on it

Is there is any other way to achieve this.
I mean using any plugin or 3rd party jar.

I am using nConvert to convert SVG files to JPEG but it doesn't support for SWF.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You can find some links regarding QT4J and JMF in the http://faq.javaranch.com/java/OtherOpenSourceProjectsFaq
Herbst Herbst

Joined: Mar 18, 2009
Posts: 2
Have you tired iWisoft swf to video converter?
It works well for me to convert swf files to many different picture formats.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Hi Herbst Herbst and welcome to Javaranch!

Can you please change your screen name in accordance with our Naming Policy, thanks

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
I agree. Here's the link: http://aspose.com/file-tools
subject: Convert SWF to jpg/jpeg/bmp/png
It's not a secret anymore!