Tag Archives: resize

Windows 7: Context Menu Image Resize: Image Resizer for Windows Software & Sites 08 MAY 2013

Having shifted to doing most of my work on a Windows 7 laptop here at home as opposed to my usual trusty Ubuntu workhorse that I’ve been using for the last couple of years, I needed to replace the useful functionality of quick image resizing via the context menu which I had simply adored on Ubuntu.

Luckily I found a great little replacement without too much difficulty: Image Resizer for Windows, written by Brice Lambson.

From their website: Image Resizer for Windows is a utility that lets you resize one or more selected image files directly from Windows Explorer by right-clicking. It was created so that modern Windows users could regain the joy they left behind with Microsoft’s Image Resizer Powertoy for Windows XP.

It’s a small download and a simple install, and I’m happy to report it works great, right out of the box. Well worth giving a run if quick image resizing is a game-changer for you then.

image resizer for windows ContextMenu

image resizer for windows ImageResizer

Related Link: http://imageresizer.codeplex.com/

Online Image Crop and Resize Tool: PicResize.com CodeUnit 02 MAY 2011

Digital cameras of today produce photos that are far too large to just easily upload and use on the Internet for general things like Facebook or blogging and for this reason you should always keep a good image resizer and cropper tool close at hand, for manipulating those big images when you need to. One of the oldest, simplest and quite effective online image resize and crop tools out there is PicResize.com, having been running since March 2005 already!

It features a very uncluttered, simple to use interface that allows you to upload an image from your machine, use a crop bounding box to crop if necessary, select from a dropdown or input custom resize values, apply cool filters just for the fun of it and then save it back to your desktop.

Simple, powerful and effective.

Just what a good online tool should strive to achieve!

Related Link: http://www.picresize.com

PHP: Generate a Thumbnail from a JPG, PNG or GIF Image File Programming 28 JAN 2011

green php elephants - elephpantsWith PHP’s built in access to the decent GD graphics library, generating a thumbnail image from a larger photo turns out to be pretty simple to achieve. Below is a function you can use to create a thumbnail image from either a JPG, PNG or GIF source image.

To use, simply supply the file path to the source image as well as the desired width (though if not given it will be defaulted to 180 pixels wide). The height of the thumbnail is automatically generated so as to keep aspect ration the same.

The function is question:

function createThumbnail($pathToImage, $thumbWidth = 180) {
    $result = 'Failed';
    if (is_file($pathToImage)) {
        $info = pathinfo($pathToImage);

        $extension = strtolower($info['extension']);
        if (in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) {

            switch ($extension) {
                case 'jpg':
                    $img = imagecreatefromjpeg("{$pathToImage}");
                    break;
                case 'jpeg':
                    $img = imagecreatefromjpeg("{$pathToImage}");
                    break;
                case 'png':
                    $img = imagecreatefrompng("{$pathToImage}");
                    break;
                case 'gif':
                    $img = imagecreatefromgif("{$pathToImage}");
                    break;
                default:
                    $img = imagecreatefromjpeg("{$pathToImage}");
            }
            // load image and get image size

            $width = imagesx($img);
            $height = imagesy($img);

            // calculate thumbnail size
            $new_width = $thumbWidth;
            $new_height = floor($height * ( $thumbWidth / $width ));

            // create a new temporary image
            $tmp_img = imagecreatetruecolor($new_width, $new_height);

            // copy and resize old image into new image
            imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
                $pathToImage = $pathToImage . '.thumb.' . $extension;
            // save thumbnail into a file
            imagejpeg($tmp_img, "{$pathToImage}");
            $result = $pathToImage;
        } else {
            $result = 'Failed|Not an accepted image type (JPG, PNG, GIF).';
        }
    } else {
        $result = 'Failed|Image file does not exist.';
    }
    return $result;
}

//calling the function
$result = explode('|',createThumbnail($sourceImagePath, 180));
            if ($result[0] != 'Failed'){
                header('Location: /thumbnails/' . basename($result[0]));
            } else {
                header('Location: error.gif');
            }

As you can see, the function above returns a string, with the string containing ‘Failed’ if the thumbnail generation has failed for some reason, otherwise returning the path to the generated thumbnail image.

Nifty.

Ubuntu Lucid Lynx: Simple Resize of Images by Right-Clicking on It! CodeUnit 26 JUN 2010

Seeing as we are all using Ubuntu/Gnome’s powerful Nautilus file manager, a particularly quick and easy way to resize or rotate images by simply right-clicking on them comes courtesy of the extremely handy little Nautilus-image-converter extension.

Installing this extension and then restarting nautilus (or simply logging out and then back in again), reveals two new right-context menu options available when clicking on an image file’s icon, namely “Rotate Images…” and “Resize Images…”. Selecting either one of these options brings up a dialog which then allows you to simply either rotate the selected images or resize them to the dimensions of your choice – without having to fire up an external application like GIMP for example!

To grab the helpful little extension, simply run the following from your terminal:

sudo aptitude install nautilus-image-converter

Simple as that! :)