ZinesFromOuterSpace Fwd: [Noisebridge-discuss] [not spam][exciting news] And now a self-important message from Sir Richard Branson.....

Tony Longshanks LeTigre anthonyletigre at gmail.com
Fri May 4 11:04:45 UTC 2012


I'm poring over this like I'm an archaeologist & this is a previously
undiscovered set of ancient Egyptian hieroglyphics....

---------- Forwarded message ----------
From: Jonathan Foote <jtfoote at ieee.org>


Also I'm too lazy to upload it to github, but here in all its glory
are the 13 lines of Python what did the job.
------------------------------------------8<------------------------------------------------------8<------------------------------------------------
#!/usr/bin/python

"""" makepdf: take all the jpgs in the current directory, sort them,
and combine them into a pdf ebook for viewing on vile proprietary systems
 """

# you need reportlab and PIL for this. Get them here:
# reportlab (for PDF generation)
http://www.reportlab.com/software/opensource/
# PIL (for reading in images) http://www.pythonware.com/products/pil/
# no closed source was used in the glomming of these jpgs!

# to get all image files: $wget wget -r -l 1 -U Mozilla -t 1 -nd -D
zine.noisebridge.net -A jpg
http://zine.noisebridge.net/2012/05/zip02-is-now-online-full-clickable-list-of-contents/

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.platypus import  Image
import glob

c = canvas.Canvas("ZIP.pdf",pagesize=letter) # create the empty output pdf

imfiles = glob.glob("./*.jpg") # get a list of all the jpgs in the current
dir

imfiles.sort() # KINDA in the right order

for f in imfiles:

   print "adding file " + f
   pageimage = Image(f, letter[0], letter[1]) # read in the image
   pageimage.drawOn(c,0,0)   # stuff it in the pdf
   c.showPage()  # render the page

c.save() # write the pdf file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noisebridge.net/pipermail/zine/attachments/20120504/000ff708/attachment-0003.html>


More information about the zine mailing list