swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swftools-common] Extracting jpg


From: Matthias Kramm
Subject: Re: [Swftools-common] Extracting jpg
Date: Sun, 13 Jul 2008 22:07:37 +0200
User-agent: Mutt/1.5.11

On Sat, Jul 12, 2008 at 05:17:46PM +0200, David Triebe <address@hidden> wrote:
> >is it possible to convert a pdf to jpg with swftools? I mean it's possible
> >in the different way, to convert jpg to swf. I guess i will need another
> >tool fort hat, o rare there any options to build  jpg from pdf or swf?
> 
> I guess swftools is absolutly the wrong tool for you  as your question 
> doesn't have anything to do with swf ;-)

Actually, swftools *can* convert a pdf to an image. :)

Option #1: 
    pdf2swf -p1 file.pdf -o file.swf
    swfrender file.swf -o file.png

Option #2: Use the python gfx module with the following script:
    import gfx
    doc = gfx.open("pdf", "file.pdf")
    page = doc.getPage(1)
    img = gfx.ImageList()
    img.startpage(page.width,page.height)
    page.render(img)
    img.endpage()
    page.save("file.png")

Of course, ImageMagick or pdftoppm is easier and more straightforward.
(Even though Option #2 has the advantage that you can also extract
 the text out of a PDF in the same go, or even run OCR over it)

Greetings

Matthias






reply via email to

[Prev in Thread] Current Thread [Next in Thread]