Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'output': 0.05; 'memory.': 0.07; 'lawrence': 0.09; 'library?': 0.09; 'pointers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'language.': 0.14; 'mostly': 0.14; "wouldn't": 0.14; 'directory)': 0.16; 'golden': 0.16; 'iterating': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'spacing': 0.16; 'subject:Converting': 0.16; 'subject:folder': 0.16; 'tjg': 0.16; 'prevent': 0.16; 'thursday,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'library': 0.18; 'thanks.': 0.20; '>>>': 0.22; 'appears': 0.22; 'example': 0.22; 'creating': 0.23; 'header:User-Agent:1': 0.23; 'harry': 0.24; 'url:moin': 0.24; 'file.': 0.24; "haven't": 0.24; 'script': 0.25; 'asking': 0.27; 'certain': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'appreciated.': 0.29; 'tim': 0.29; 'especially': 0.30; "i'm": 0.30; 'code': 0.31; 'url:wiki': 0.31; 'subject:per': 0.31; 'file': 0.32; 'quite': 0.32; 'url:python': 0.33; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'convert': 0.35; 'hundreds': 0.35; 'usual': 0.35; 'but': 0.35; 'done': 0.36; 'useful': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'january': 0.37; 'too': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'generating': 0.39; 'pdf': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'read': 0.60; 'above,': 0.60; "you're": 0.61; 'save': 0.62; 'email addr:gmail.com': 0.63; 'name': 0.63; 'our': 0.64; 'dear': 0.65; 'sample': 0.67; 'side': 0.67; 'internet': 0.71; 'about?': 0.84; 'received:89': 0.85; 'capture': 0.91; 'contents.': 0.91; 'hundred': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Converting folders of jpegs to single pdf per folder Date: Thu, 16 Jan 2014 20:01:17 +0000 References: <0c648d2d-d8b3-4848-8b37-1e5e1ae40327@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-240-165-224.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <0c648d2d-d8b3-4848-8b37-1e5e1ae40327@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 72 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389902490 news.xs4all.nl 2839 [2001:888:2000:d::a6]:59398 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64104 On 16/01/2014 19:50, vasishtha.spier@gmail.com wrote: > On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: >> On 16/01/2014 19:11, Harry Spier wrote: >> >>> >> >>> Dear list members, >> >>> >> >>> I have a directory that contains about a hundred subdirectories named >> >>> J0001,J0002,J0003 . . . etc. >> >>> Each of these subdirectories contains about a hundred JPEGs named >> >>> P001.jpg, P002.jpg, P003.jpg etc. >> >>> >> >>> I need to write a python script that will cycle thru each directory and >> >>> convert ALL JPEGs in each directory into a single PDF file and save >> >>> these PDF files (one per directory) to an output file. >> >>> >> >>> Any pointers on how to do this with a Python script would be >> >>> appreciated. Reading on the internet it appears that using ImageMagick >> >>> wouldn't work because of using too much memory. Can this be done using >> >>> the Python Image Library or some other library? Any sample code would >> >>> also be appreciated. >> >> >> >> The usual go-to library for PDF generation is ReportLab. I haven't used >> >> it for a long while but I'm quite certain it would have no problem >> >> including images. >> >> >> >> Do I take it that it's the PDF-generation side of things you're asking >> >> about? Or do you need help iterating over hundreds of directories and files? >> >> >> >> TJG > > Its mostly the PDF generating side I need but I haven't yet used the Python directory and file traversing functions so an example of this would also be useful especially showing how I could capture the directory name and use that as the name of the pdf file I'm creating from the directory contents. > > Thanks again, > Harry > I'm sorry that I can't help with your problem, but would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spacing above, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence