The Shape of Everything
A website mostly about Mac stuff, written by August "Gus" Mueller
» Acorn
» Retrobatch
» Mastodon
» Micro.blog
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
July 15, 2008
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)

I've been doing a bit of website work lately (using Coda of course), and I've found myself resizing images quite a bit. Unfortunately this also means I have to update the width and height attributes for the image tags, which was getting annoying.

What I really need is a "copy width and height tag from image" in Coda, but since I don't have that I made this little Python plugin for Acorn:

ACScriptSuperMenuTitle = None ACScriptMenuTitle = "Copy Width and Height" from AppKit import *

def main(image):   pb = NSPasteboard.generalPasteboard()   pb.declareTypes_owner_([NSStringPboardType], None)   s = 'width="%d" height="%d"' % (image.extent()[1][0], image.extent()[1][1])   pb.setString_forType_(s, NSStringPboardType)   return None

And since the image I'm working on is usually open in Acorn anyway, this works out perfectly.

P.S. - did you know you can setup Acorn as an image editor for Coda? It's pretty sweet- you just right click on an image in the source list, and choose "Edit With Acorn". Any saves you make go right back to the server.