Skip to content

Instantly share code, notes, and snippets.

Created April 7, 2014 08:20
What would you like to do?
Resize images from size in HTML
module='tagsoup', version='1.2' )
def tagsoupParser = new org.ccil.cowan.tagsoup.Parser()
def slurper = new XmlSlurper(tagsoupParser)
def htmlParser = slurper.parseText(new File('file.html').text)
htmlParser.'**'.findAll{ == 'img'}.each {
if(it.@width != "") {
println "Resizing ${it.@src} to width ${it.@width}"
def p = "convert ${it.@src} -resize ${it.@width} ${it.@src}".execute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment