{"id":499,"date":"2015-12-29T17:09:07","date_gmt":"2015-12-29T16:09:07","guid":{"rendered":"http:\/\/hamsterhirn.de\/?p=499"},"modified":"2015-12-30T11:37:02","modified_gmt":"2015-12-30T10:37:02","slug":"convert-powerpoint-to-jpg-or-png-or-whatever","status":"publish","type":"post","link":"https:\/\/hamsterhirn.de\/index.php\/2015\/12\/convert-powerpoint-to-jpg-or-png-or-whatever\/","title":{"rendered":"convert Powerpoint to JPG or PNG or whatever"},"content":{"rendered":"<p>I had to find an easy solution for my colleaugue to convert Powerpoint files to e.g. JPGs.<br \/>\nThey have a big screen where they want to do slideshows and the people do Powerpoint files for easy changes.<br \/>\nInstead of doing all manually with save as and such it should be an automatic conversion.<\/p>\n<p>Here is the batch <em>convertPowerpoint2JPG.bat<\/em> I came up with:<\/p>\n<blockquote><p><pre><code class=\"preserve-code-formatting\">@echo off\nSET imagemagickpath=%~dp0\nset filepath=%~dp1\nset extension=%~x1\nset filename=%~n1\necho convert Powerpoint to PDF\nif exist &quot;%filepath%%filename%.pdf&quot; del &quot;%filepath%%filename%.pdf&quot;\nCSCRIPT &quot;%imagemagickpath%ppt2pdf.vbs&quot; &quot;%filepath%%filename%%extension%&quot; &quot;%filepath%%filename%.pdf&quot;\nif not exist &quot;%filepath%%filename%&quot; mkdir &quot;%filepath%%filename%&quot;\necho convert PDF to JPGs\n&quot;%imagemagickpath%convert.exe&quot; -monitor -quality 100 -unsharp 0x1 -density 400 &quot;%filepath%%filename%.pdf&quot; -resize 60%% &quot;%filepath%%filename%\\%filename%.jpg&quot;\nexit \/b<\/code><\/pre><\/p><\/blockquote>\n<p>It uses a vbs Skript to invoke Powerpoint for pdf saving and then converts the PDF with ImageMagick (actually the embedded portable GhostScript) to JPG.<\/p>\n<p>The code for ppt2pdf.vbs is:<\/p>\n<blockquote><p><pre><code class=\"preserve-code-formatting\">Option Explicit\n\nSub WriteLine ( strLine )\n&nbsp;&nbsp;&nbsp;&nbsp;WScript.Stdout.WriteLine strLine\nEnd Sub\n\n&#039; http:\/\/msdn.microsoft.com\/en-us\/library\/office\/aa432714(v=office.12).aspx\nConst msoFalse = 0&nbsp;&nbsp; &#039; False.\nConst msoTrue = -1&nbsp;&nbsp; &#039; True.\n\n&#039; http:\/\/msdn.microsoft.com\/en-us\/library\/office\/bb265636(v=office.12).aspx\nConst ppFixedFormatIntentScreen = 1 &#039; Intent is to view exported file on screen.\nConst ppFixedFormatIntentPrint = 2&nbsp;&nbsp;&#039; Intent is to print exported file.\n\n&#039; http:\/\/msdn.microsoft.com\/en-us\/library\/office\/ff746754.aspx\nConst ppFixedFormatTypeXPS = 1&nbsp;&nbsp;&#039; XPS format\nConst ppFixedFormatTypePDF = 2&nbsp;&nbsp;&#039; PDF format\n\n&#039; http:\/\/msdn.microsoft.com\/en-us\/library\/office\/ff744564.aspx\nConst ppPrintHandoutVerticalFirst = 1&nbsp;&nbsp; &#039; Slides are ordered vertically, with the first slide in the upper-left corner and the second slide below it.\nConst ppPrintHandoutHorizontalFirst = 2 &#039; Slides are ordered horizontally, with the first slide in the upper-left corner and the second slide to the right of it.\n\n&#039; http:\/\/msdn.microsoft.com\/en-us\/library\/office\/ff744185.aspx\nConst ppPrintOutputSlides = 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#039; Slides\nConst ppPrintOutputTwoSlideHandouts = 2&nbsp;&nbsp;&nbsp;&nbsp; &#039; Two Slide Handouts\nConst ppPrintOutputThreeSlideHandouts = 3&nbsp;&nbsp; &#039; Three Slide Handouts\nConst ppPrintOutputSixSlideHandouts = 4&nbsp;&nbsp;&nbsp;&nbsp; &#039; Six Slide Handouts\nConst ppPrintOutputNotesPages = 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#039; Notes Pages\nConst ppPrintOutputOutline = 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039; Outline\nConst ppPrintOutputBuildSlides = 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039; Build Slides\nConst ppPrintOutputFourSlideHandouts = 8&nbsp;&nbsp;&nbsp;&nbsp;&#039; Four Slide Handouts\nConst ppPrintOutputNineSlideHandouts = 9&nbsp;&nbsp;&nbsp;&nbsp;&#039; Nine Slide Handouts\nConst ppPrintOutputOneSlideHandouts = 10&nbsp;&nbsp;&nbsp;&nbsp;&#039; Single Slide Handouts\n\n&#039; http:\/\/msdn.microsoft.com\/en-us\/library\/office\/ff745585.aspx\nConst ppPrintAll = 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039; Print all slides in the presentation.\nConst ppPrintSelection = 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039; Print a selection of slides.\nConst ppPrintCurrent = 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039; Print the current slide from the presentation.\nConst ppPrintSlideRange = 4&nbsp;&nbsp;&nbsp;&nbsp; &#039; Print a range of slides.\nConst ppPrintNamedSlideShow = 5 &#039; Print a named slideshow.\n\n&#039; http:\/\/msdn.microsoft.com\/en-us\/library\/office\/ff744228.aspx\nConst ppShowAll = 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#039; Show all.\nConst ppShowNamedSlideShow = 3&nbsp;&nbsp;&#039; Show named slideshow.\nConst ppShowSlideRange = 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039; Show slide range.\n\n&#039;\n&#039; This is the actual script\n&#039;\n\nDim inputFile\nDim outputFile\nDim objPPT\nDim objPresentation\nDim objPrintOptions\nDim objFso\n\nIf WScript.Arguments.Count &lt;&gt; 2 Then\n&nbsp;&nbsp;&nbsp;&nbsp;WriteLine &quot;You need to specify input and output files.&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;WScript.Quit\nEnd If\n\ninputFile = WScript.Arguments(0)\noutputFile = WScript.Arguments(1)\n\nSet objFso = CreateObject(&quot;Scripting.FileSystemObject&quot;)\n\nIf Not objFso.FileExists( inputFile ) Then\n&nbsp;&nbsp;&nbsp;&nbsp;WriteLine &quot;Unable to find your input file &quot; &amp; inputFile\n&nbsp;&nbsp;&nbsp;&nbsp;WScript.Quit\nEnd If\n\nIf objFso.FileExists( outputFile ) Then\n&nbsp;&nbsp;&nbsp;&nbsp;WriteLine &quot;Your output file (&quot; &amp; outputFile &amp; &quot;) already exists!&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;WScript.Quit\nEnd If\n\nWriteLine &quot;Input File:&nbsp;&nbsp;&quot; &amp; inputFile\nWriteLine &quot;Output File: &quot; &amp; outputFile\n\nSet objPPT = CreateObject( &quot;PowerPoint.Application&quot; )\n\nobjPPT.Visible = True\nobjPPT.Presentations.Open inputFile\n\nSet objPresentation = objPPT.ActivePresentation\nSet objPrintOptions = objPresentation.PrintOptions\n\nobjPrintOptions.Ranges.Add 1,objPresentation.Slides.Count\nobjPrintOptions.RangeType = ppShowAll\n\n&#039; Reference for this at http:\/\/msdn.microsoft.com\/en-us\/library\/office\/ff746080.aspx\nobjPresentation.ExportAsFixedFormat outputFile, ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoTrue, ppPrintHandoutHorizontalFirst, ppPrintOutputSlides, msoFalse, objPrintOptions.Ranges(1), ppPrintAll, &quot;Slideshow Name&quot;, False, False, False, False, False\n\nobjPresentation.Close\nObjPPT.Quit<\/code><\/pre><\/p><\/blockquote>\n<p>Sorry, I forgot the source. If you know it, let me know.<\/p>\n<p>I used a portable version of ImageMagick and a portable version of GhostScript. You have to integrate GhostScript into ImageMagick in the file <em>delegates.xml<\/em>. Place GhostScript in ImageMagick folder and replace all appearances of <em>gswin32c.exe<\/em> with <em>Ghostscript\\bin\\gswin32c.exe<\/em> (if that is the path of your portable GhostScript).<\/p>\n<p>Now just drag a ppt(x) file onto <em>convertPowerpoint2JPG.bat<\/em> and it creates a folder in the same directory where your ppt(x) resides and puts numbered JPGs in that folder.<\/p>\n<p><a href=\"http:\/\/hamsterhirn.de\/ImageMagick-6.9.2-7-portable-Q16-x64.7z\">You can download my example for trying it out yourself (Windows x64 version).<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had to find an easy solution for my colleaugue to convert Powerpoint files to e.g. JPGs. They have a big screen where they want to do slideshows and the people do Powerpoint files for easy changes. Instead of doing all manually with save as and such it should be an automatic conversion. Here is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[82,250,251,244,249,246,247,245,248,252,88],"class_list":["post-499","post","type-post","status-publish","format-standard","hentry","category-it","tag-batch","tag-convert-ppt-to-jpg","tag-convert-ppt-to-png","tag-convert-pptx-to-jpg","tag-convert-pptx-to-png","tag-ppt2jpg","tag-ppt2png","tag-pptx2jpg","tag-pptx2png","tag-vbs","tag-windows"],"_links":{"self":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/comments?post=499"}],"version-history":[{"count":4,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/499\/revisions"}],"predecessor-version":[{"id":508,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/499\/revisions\/508"}],"wp:attachment":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/media?parent=499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/categories?post=499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/tags?post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}