• Taming tasks with Python

    How would I even start! Where would I find the time! What about all the mistakes I’d make.

    I had been asked to insert and edit over 204 images into 459 page word document, all images had to be the exact same size in the exact same place.

    Manually it would take forever. There had to be a better way.

    Many office tasks are boring and repetitive. If only there was a way to automate the boring stuff. In this example adding the images manually would have been time-consuming, error prone, and just plain boring. In a departure from my usually blog posts on Architectural photography, I though I would include a post on some of the technical solutions I’ve worked on in the office.

    “Talk Python to me” podcast episode #19 featured Al Sweigart.   His goal is to teach the python programming language to students, office workers , admin staff  to improve their work. His method teaches the python to automate common tasks. The site www.automatetheboringstuff.com is open source allowing any to delve in and learn the python programming language at your ease.

    Python is a simple, easy to learn and its syntax emphasizes readability. The language is very close to english and is very easy to learn. Python is used by many of the worlds biggest software companies. It is also gained popularity as a first language for University students.
    Python can be used to open, edit, save and delete files,it can find text and add images to document. This is just what I needed.

    For my project the task was to, open the document, search for the mention of a .jpg file, then insert that image file in the paragraph text.

    To open the .docx file we use PyDocx , the searching uses a Regular Expression Library: Regex. Then the script simply loops through all runs within all paragraphs and inserts the relavant image from a folder.

    Is there anything more?

    Only one thing, the add_picture function uses a “try/ except” flow so that any failures can be captured in a list.

    Simple, its so simple. Overall it took about 30 minutes to write and test the script. Heres the code.

    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
    #The .docx element of the script is an adapation of code from https://automatetheboringstuff.com/chapter18/
    #The regex element of the script is an adapation of code from https://automatetheboringstuff.com/chapter7/
    import docx
    #Imports pyton-docx
    import re
    #Imprts Regex
    doc=docx.Document(‘testword.docx’)
    # The testword.docx is stored in the same folder as the script.
    faillist=[]
    #This initialises the faillist as a list
    print len(doc.paragraphs)
    #This prints to the console the lenght of paragraphs in the text
    for i in range(len(doc.paragraphs)):
    #This loops over the paragraphs
    for j in range(len(doc.paragraphs[i].runs)):
    #This loops over the runs ( blocks of text) in each paragraph
    imgname= re.compile(r’\d\d\d\d\d\d_00.jpg’)
    #Matches all filenames with a 6 digit prefix followed by _00.jpg
    imgret=imgname.search(doc.paragraphs[i].runs[j].text)
    # This searchs for a pattern match
    if imgret!=None:
    #If there is a pattern match in the run ( text block) search for a file that matches that name
    doc.paragraphs[i].runs[j].add_break()
    try:
    doc.paragraphs[i].runs[j].add_picture(“image_folder/”+imgret.group(),height=docx.shared.Cm(6))
    # Insert matching name form a local folder called ” image_folder”, sets the size to be 6cm high
    except:
    faillist.append(imgret.group())
    # If there is no match, add that to a list. This is so i can see if there are any problems
    print faillist
    # print ” This is awesome”
    # This is a optional print statement if you wish to celebrate your awesomeness.
    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

    In python all this can be completed with relative ease. There is a library for opening .docx files, and a library for matching text. Fortunately the file-name of each image is mentioned on each page.
    https://www.python.org/doc/essays/blurb/
    https://automatetheboringstuff.com/


  • Nowhere

    Retail Photography retail design blog

    Nowhere store design by ABGC was launched at the beginning of 2015 . Retail Design Blog have writing a blog piece on the design and installation.

    http://retaildesignblog.net/2015/07/10/nowhere%E2%80%8B-store-by-abgc-dublin%E2%80%8B-ireland/

    screen shot of retail design blog

    screen shot of retail design blog


  • Horse with house in tipperary

    Linking the past to the present

    Some architectural photography of Puckan Tipperary was recently republished by the Journal.ie Gary Mongey of Box Architecture designed the extension for a 1940’s cottages. The result is a comptempory clean architectural design and creates a harmonious modern space. The full article is here hhttp://paultierney.com/portfolios/box-architecture-tipperary-private-house/ the journal article is here http://www.thejournal.ie/glass-box-link-extension-2137370-Jun2015/

    Screenshot of the journal

    Screenshot of the journal


  • Architectural Photograph of Mater Hosipital

    Best Healthcare Project in the R.I.A.I Irish Architecture Awards 2014

    Scott Tallon Walker Architects have been awards best Healthcare project in the 2014 Irish Architecture awards for the Mater Hospital. The mater hospital is located in central Dublin. The building is a modern addition to the city that sensitively aligns the tone of local materials and grain with the demands of a functioning health building. The building creates a positive impact in the area by creating a new urban space on the North Circular Road. The modelling of the 3 dimensional form blends the low density surroundings to a high density modern hospital.
    The main photograph presented in the awards was photographed recently by our company. Photographing the building was a difficult task due to the alignment of the building and parking issues in the area.


  • Art photography mermaid arts centre wicklow

    Hexagon Mermaid Arts Centre

    Hexagon presented print words by six professional artists. The photography documented the exhibitions and was reproduced in brochure form. The work was both collaborative and individual in nature. The participant artists presented their own pieces in response to the team.

    The challenge, from a photographic, was to represent the work of the artists as a cohesive exhibition while at the same time show the individual elements. Some of the pieces were presented as installations. It was a challenge to illustrate the sense of the spaces as there had been presented by the artists, rather than simply document the environment.

    Test from mermaid arts centre:

    Hexagon is about professional artists discovering, or rediscovering, printmaking as a medium full of possibility.This exhibition is the culmination of a project and residency that shows the work of the six participating artists. The artists that participated in Hexagon include three professional Wicklow based artists; Aoife Flynn, Laura Kelly and Joanna Kidney, and three members of Cork Printmakers; Conall Cary, Dominic Fee and Fiona Kelly. The six artists worked together over a two week residency from 28th July to the 8th August 2014 at Cork Printmakers’ Studio, Cork City. This residency offered the artists a unique opportunity to collaborate, learn new skills and explore techniques in a professional print studio. The development of hybrid approaches and challenge to traditional boundaries of printmaking, enables audiences to see printmaking in a new light.

    http://www.mermaidartscentre.ie/exhibitions/details/hexagon1