 shows that people will probably roll up over the next couple of minutes as they work out morning teas finished. So welcome to the 2015 multimedia and music mini conf. The mini conf has its own website at the address which is on the screen at the moment which is sort of the definitive source for information about the mini conf. The timetable is mirrored on the LCA website and over time things like slides and recordings of today might make it onto that site as well I'm not sure. I'm going to endeavour to try and get slides and things up onto the site there as quickly as I can just as a record of the day. Today we've got three sessions morning session then there's lunch a G streamer session at 1320 and then an afternoon session at 1540 after afternoon tea. So this morning we've got four speakers going to present on a variety of topics as outlined there and in the in the program as well on the on the web. For people wanting to ask questions you just ask that you wait for this mic to be passed around not so that people can hear you in the room necessarily but so the streaming and the recording people can hear what you have to say and the speaker doesn't have to repeat the question. For those who are giving talks if someone asks a question and it's not like if you can just sort of briefly summarise the question so that again the streaming guys and people who are watching the stream have a chance to pick up what the question was. So without further ado I'm going to invite Katie Ford and she's going to give a talk entitled disentangle a new fangled image mangler and yes I did practice that. You practiced it I didn't and I'm already losing this thing. Everyone can see that? Both sides? Can I be heard on the... Got to move it down. Yeah it kind of it's falling off my ear I don't think my ear is a big enough. No no it's okay I'll just not move. Oh okay. I don't know they're sort of burning already does that? Is that better? Maybe position-wise? Yeah yeah yeah that's fine. Yeah oh good oh good lock the door. Hi guys I'm Katie I made a thing and I'm going to present it to you. I would ask with the questions thing unless I actually put my hand up please don't yell out the answer this is going to be a journey about how I learnt a whole lot of things some of the answers are going to be easy but if I put my hand up you can shout out I was going to bring cookies but they got taken away at customs. So a little bit of background I'm sorry I'm sorry LCA it has been two years since my last actual Windows job but I used to do this kind of XP stuff and it's flickering that's not good are there demons in it? No okay so this used to be my desktop environment I used to code Oracle in Windows but this was my environment and this was my desktop I had a really really tiny screen and I had this little tiny image that I found somewhere on the internet and I wanted to have it as a wallpaper in XP you can put as a wallpaper and then you can stretch it but that looked horrible so what I wanted to do was make something that wouldn't look horrible and you can do this in four steps these are going to be repeated all the way through the presentation so remember them find your background resize it to your resolution move the image around to where you want it and then fill in the background that was probably white how do you do this on Windows? Hands up how do you do this on Windows? MS Paint! MS Paint! I would throw you a cookie so method one MS Paint you find your image you grab the little thing and you drag it around and then you grab the thing and then you move it to the corner and then you get the little eyedropper and then you fill it in so how do you do this less manually in Paintware you can do like key things but no one's here is really interested in that you can do the entire thing using a keyboard but who does that it's Windows so many months later I got hired for a company I actually work at Anker now there's 19 of us a couple of them are possibly in the room I wasn't allowed to use Windows there because no one's allowed to use Windows there I was given the option of Ubuntu or Gentoo I chose Ubuntu because I could spell it so I needed a way to be able to make my desk backgrounds because I got a big screen it was like 24 inches or something instead of 17 so I needed to redo all my backgrounds because none of them would fix it all stretch so how do you programmatically make a background in Linux gentlemen in the hat Ta-da! Image Magic! So this is literally how I learned to use a whole lot of command line tools so bear with me image magic you've got a executable called convert and you can resize things and you can give it your before image and your after image except it stretches that's not not what we want we want to make it the same resolution but we want to move it so you can extend it except in this order it resizes it first and then it extends it so it's still stretched but it's the right resolution if you swap that you can get it in the right resolution but it's in the wrong corner so you set gravity not the Sandra Bullock film and then you can get it in your corner and then as long as you know the background color you can fill it in so then you get a background problem this little hash magic thing how do you how can you on the command line without human interaction get the background color of an image hands up well the gentleman in the hat said it before you can actually use just image magic again there's this wonderful thing where you can analyze the image in histogram and you can output it in a image so you get your image and then you do things and then you get another image not really that helpful that's me the mouse but you can actually get it in a format that's machine readable except there's a few lines that come out in that output because it tells you exactly how many pixels of each color in your image but you throw 16 colors at it and it will at least reduce it down to a standard set and then you can sort it because this is how I learned how to do sort and head and trim and cut so you can literally take the output from this and then you head it and then you cut it and trip it and then you can get that little hex value translate okay there you go I learned something I it's TR trim well in in that one it's like you space that's ashes for space you go I learned something this is cool so I can take my rhino image and I can get the color and then I can throw that in my script because I can make it useful by throwing it in a bash file and so I give it the image and then I give it the resolution I give what it wants to go and I create an image but I then realize that hey I work at a web hosting company and this is a shell script so guess what I did close rails I wrapped my shell script in rails and added some bootstrap and some fanciness so you can upload an image you can see your image with a really nice preview that took a lot of time I'm just like oh most of rails except for the stuff I was actually doing at work at the time but you can upload an image and it automatically create a few for you and it would be wonderful so I was pretty happy with this this was all hope hosted up on open shift so it was nice it just worked and then I came back to it and it had broken turns out I got popped because you're not supposed to wrap a shell script in Ruby so make sure if you're ever gonna do this sanitize your uploads and don't just use back ticks in web server code ever yeah so uploads are bad unless you sanitize them so how about I just pre-render all the images I want fun story I found this two years after I found that little image first I didn't realize it could come on a t-shirt and then I bought the t-shirt and I found it and it turns out that this particular store has the source images of their shirt in a really nice format so you can get all the shirts because it goes 999 1000 1000 one all the way through I think they're up to six 6,000 images now so with a great big recursive grep I could look W get or curl whatever I use you could pull them all down and then for every single resolution generate them all so I could make a great big image cache so this was big 200 gig or something because I wasn't using proper compression and it was 10 resolutions every image and there were 6,000 images and it just was big but I pre-generate them all for all the right things except who can see what's wrong at the start that's not actually a resolution I transcribed it wrong and I also sort of filled up my VPS yeah so what I want to do is dynamically create images that I want at the time that I want them not fill out my disk not have the disk be popped all the VPS popped can you pop a disk just by anyway with a hammer maybe no I want to just create what I want so obligatory cat pictures this is a service that gives you sized cat pictures as a service you can use it for when you're templating and stuff as opposed to just using a placeholder and it will give you cats but the nice little you're up here gives you a width and a height so I decided that's cool I'm going to replicate this so I made an API that would take the idea of an image from that particular store and a height and the width and would generate a wallpaper for you that's not really as good as I want as I said I work at a web hosting company I could make an API or I could make a website so what you do you wrap your API in a website and this is what I'm up to today which is that's a real site and actually works and I'm going to totally show a demo if that's the right button haha so this is the live website it's actually a domain it's not hackery this I haven't changed my ETC host or anything so I can click any of these and it'll make the right resolution for me so I'm gonna click a thing and that won't work I want that work now it'll totally work why won't it work I know okay so what's happened is because I plugged in it and this was preloaded it didn't get my right resolution so now on the right resolution for this and I should there we go see every size did you get the great big black thing and then you get a super nova yeah I actually own all these shirts so I don't feel too bad reusing the artist things as much anyway so the main thing that drives this is there's no real way to get the resolution unless you tell it to so you can do this thing and change it but guess how you get the resolution yeah JavaScript that that's all you do because it'll actually tell you the resolution of your current thing and because I plugged in the VGA it still had my native resolution of sixteen nine hundred and then I refresh the page and it got the right one so you just use that and then you tell it to go to the API and that's I thought that was really cool so all the code is open source I've run for about half the time I'm supposed to which I was assuming that they'd be like more pre-talking or we'd be late or something but if anyone has any questions that aren't trolling please don't pick on me because I used to do Windows everyone has to start somewhere no anyone no well in that case I'm done because there's a cat picture and it says yay and I'm done oh yeah we've got to wait for a mic though otherwise I'll have to repeat you so I take your web posting company generally works with Ruby on rails that this entire project has been going for me for about four years the Ruby part was about two years ago and we don't actually use Ruby anymore so the next iteration of this would be in our current language which would be Haskell I really do not want to try to make a wrapper for image magic in Haskell just yet that would be fun but not exactly safe well I probably wouldn't get popped because it's all safe but yeah yeah I've heard PHP League has a nice wrapper for that except I tried to use that when someone told me it and then composer broke and then I tried to bug fix composer and that's not really something I wanted to do so I stopped I worked out what that was though so the version of that didn't have the composer widget that says a requirement is the GD compiled version of PHP except the version that was coming down from the composer packages was version one and they fixed this in 105 but composer didn't know the 105 existed so I actually submitted a fix saying here's the thing it's like no it's already there I'm like but the packages doesn't work and yes so as soon as you start debugging the package manager for a language that you really don't want to touch that's when you start stepping away and re-evaluating your life choices you gotta put the similar sort of imagery sizing sort of stuff with PHP but not nearly as smart as that yeah it's really fun because the algorithm thing for the where is it back back back this this thing turns out that's actually really slow you can do it a whole lot better by just getting the corners and checking like all of eight points around the edges except in the this one the algorithm that I had would take the purple of his little explosion because that was in the top corner and then make the entire thing purple yeah it did it did actually look impressive but yeah anyway and I'm taking long form questions even though you're not supposed to because I've got so much time left that's okay yeah it's all good yeah okay cool any other questions qualms comments do you want me to bring back the cat pictures or okay now we for time we good can I stop talking thank you thank you Katie okay so we've got a brief five minute interlude while we'll change over to the next speaker who's been savage and then he's going to be talking on learning to site read with