Posts Tagged tools

Self Made Tools: Proportional Image Resizer

Posted by Matt Kendrick on Monday, 29 March, 2010

I’ve decided to create a new segment on my site called “Self Made Tools.” From time to time, I make software tools to help me through tasks that I can’t find tools for quickly. I’ve decided to really jump on the Open Source movement bandwagon and share my tools with source. This week’s tool is “Proportional Image Resizer.” What? Ok, let me explain.

When coding HTML, you know when you have an image that is one size and you need it to fit within an area that is of another. Say the image is 800 px X 600 px and you need to make it fit into an area that is 500 px wide spot. Easy right? Just change the one dimension in your code to reflect the change. Sure your browser will adjust your image. But it may not pass some web standards for all browsers. It’s just not clean. You need to have both a width and height specified when resizing an image using code.

How do you resize these images proportionally? Use a simple equation to do the job. You know the before image is 800 px X 600 px right? You also know you need the image to fit within a 500 px width. Now you just need the other part of the equation (solve for x).

800 / 600 = 500 / X

Cross multiply and you’re done right? How about we just skip doing the equation every time and just use a tool? That’s how the proportional image resizer tool was born. You can also do the reverse as well (height vs width). I know there are other tools out there to perform the task. But why not use something homegrown? You could even code this yourself in a matter of minutes. I’ve posted the source to the script above. Thanks for reading!

<html>
<head>
<title>Proportional Image Resizer</title>

<script language='Javascript'>
//Matt Kendrick
//March 28, 2010

function resize_by_width(width)
{

var x_before = document.getElementById('x_before').value;
var y_before = document.getElementById('y_before').value;

var x_new = width;
var y_new;

//a / b = c / x

//x = (c * b) / a

y_new = (x_new * y_before) / x_before;

document.getElementById('y_new').value = y_new;

}

function resize_by_height(height)
{

var x_before = document.getElementById('x_before').value;
var y_before = document.getElementById('y_before').value;

var x_new;
var y_new = height;

//a / b = x / c

//x = (c * b) / a

x_new = (x_before * y_new) / y_before

document.getElementById('x_new').value = x_new;

}

</script>

<style>
.dim_box {width:50px;}
</style>

<head>
<body>

<h2>Proportional Image Resizer</h2>

<b>Instructions</b><br>
<p>
Enter the starting dimensions of the image. <br>
Then enter the dimensions you would like to conform the image to. <br>
<br>
ex. You have an image that is 800 x 600, and you need it to fit the image <br>
proportionaly in a 525 pixel wide area. Enter 800 for the width and 600 for <br>
the height in the before dimensions. Then enter 525 in the after dimensions <br>
width. The script will then compute the proportional height for you.
</p>
<br>

<b>Before Dimensions</b><br>
Width: <input type='text' id='x_before' class='dim_box' value=0> Height: <input type='text' id='y_before' class='dim_box' value=0><br><br>

<b>After Dimensions</b><br>
Width: <input type='text' id='x_new' class='dim_box' onKeyUp='resize_by_width(this.value);' value=0> Height: <input type='text' id='y_new' class='dim_box' onChange='resize_by_height(this.value);' value=0><br><br>

</body>
</html>

Google BuzzBlogger PostTwitterYahoo BookmarksGoogle GmailBeboGoogle ReaderStumbleUponYahoo BuzzYahoo MailRedditMySpaceDeliciousAmazon Wish ListWordPressYahoo MessengerFarkGoogle BookmarksSquidooTumblrShare

LC ISO Creator – Portable ISO Creation Software

Posted by Matt Kendrick on Wednesday, 17 June, 2009

I’m a big fan of freeware tools. This morning, I found a very simple program to create ISO images of CD/DVDs. ISOs make it really easy to distribute or burn disk images. This app is portable (runs from a usb drive), very lite (52kb) and extremely simple to use.

  1. Open the application
  2. Choose which disc your wanting to convert to ISO
  3. Click “Create ISO”.
  4. Select the location/Name your ISO file.

This one has earned a spot in my usb toolbox. Find out more about it at  http://www.pendriveapps.com/lc-iso-creator-portable-iso-creation/

Google BuzzBlogger PostTwitterYahoo BookmarksGoogle GmailBeboGoogle ReaderStumbleUponYahoo BuzzYahoo MailRedditMySpaceDeliciousAmazon Wish ListWordPressYahoo MessengerFarkGoogle BookmarksSquidooTumblrShare

Weekend Update – May 3rd 2009

Posted by Matt Kendrick on Sunday, 3 May, 2009

Its been a real rainy weekend. Spent most of the time indoors. Catie and my wife Heather went up to Ashland, KY to help out Catie’s parents. They were setting up a yard garage sale. Meanwhile, back in Richmond, Dave and I had some guy time. Boy we had fun!

Went to Krystal’s and ate. We usually go to places the girls don’t like. We got a two man combo meal. 12 Krystal burgers, 2 fries and 2 drinks were slaughtered in nearly 20 minutes. Then it was off to Big Lots to look at cheap tools. Then we went to Lowe’s to look at expensive tools. After we wiped the drool off the tools, we went and looked at building materials.

Dave’s been talking about getting into metal work. So we discussed the basics. But we both agreed he needed a work bench. So we looked at supplies and plans for that. However there were no plans to be found. The store was about to close. Wouldn’t be the first time we closed somewhere. But anyways we looked at plans online. We were real surprised when we found videos on YouTube (below). Also found out how not to build a work bench.

Dave went home about 11:00pm, and I stayed up and watched movies. Sometime around 1:30am or so I fell asleep. Real odd waking up the next morning and not having my girl next to me. Saturday was free comic book day at the Cosmic Oasis store in town. They asked Dave to come out and be Captain America for the kids. I was hoping to get out there and have some pictures for you. But I didn’t make it out there in time. But they did snap some for him. Maybe we’ll have some to post soon. Dave said it was a real bust. No kids. But he did score some free comic books.

After that Dave and I went to Harbor Freight to do some more tool shop’n. Dave found a metal shaping bag. I didn’t pick anything up. But I saw a lot of stuff I’d like to have. Looked at air compressors, hammers and all kinds of goodies. Including this mini table saw. The girls came home later on. Heather and I settled in and played some games on Facebook. Some include Vampire Wars and Farm Town. (more on that later).

Sunday, another rainy day. Heather and I just stayed in and played some more Farm Town. Proud to say I’m a level 5 farmer. Its addicting be careful! Other then that, we’ve just been chill’n. Nice to have a laid back weekend. Next weekend we’re heading to Elkhorn City. My mom is having a heart cath done. Please keep her in your thoughts and prayer concerns. Catch ya laters!

Google BuzzBlogger PostTwitterYahoo BookmarksGoogle GmailBeboGoogle ReaderStumbleUponYahoo BuzzYahoo MailRedditMySpaceDeliciousAmazon Wish ListWordPressYahoo MessengerFarkGoogle BookmarksSquidooTumblrShare