Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
444 views
in Technique[技术] by (71.8m points)

jpeg - How to convert pptx files to jpg or png (for each slide) on linux?

I want to convert a powerpoint presentation to multiple images. I already installed LibreOffice on my server and converting docx to pdf is no problem. pptx to pdf conversion does not work. I used following command line:

libreoffice --headless --convert-to pdf filename.pptx

Is there es way to convert pptx to pngs immediately or do I have to convert it to pdf first and then use ghostscript or something?

And what about the quality settings? Is there a way to choose the resolution of the resulting images?

Thanks in advance!

EDIT: According to this link I was able to convert a pdf to images with the simple command line:

convert <filename>.pdf <filename>.jpg 

(I guess you need LibreOffice and ImageMagick for it but not sure about it - worked on my server)

But there are still the problems with the pptx-to-pdf convert.

Thanks to googling and Sebastian Heyn's help I was able to create some high quality images with this line:

convert -density 400 my_filename.pdf -resize 2000x1500 my_filename%d.jpg

Please be patient after using it - you still can type soemthing into the unix console but it's processing. Just wait a few minutes and the jpg files will be created.

For further information about the options check out this link

P.S.: The aspect ratio of a pptx file doesn't seem to be exactly 4:3 because the resulting image size is 1950x1500

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After Installing unoconv and LibreOffice you can use:

unoconv --export Quality=100 filename.pptx filename.pdf 

to convert your presentation to a pdf. For further options look here.

Afterwards you can - as already said above - use:

convert -density 400 my_filename.pdf -resize 2000x1500 my_filename%d.jpg 

to receive the images.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...