How to create HDR images in Gimp with a single image

Posted by ljmacphee on February 6, 2008 under gimp, graphics, how to | Read the First Comment

HDR images are normally shot with your camera set up on a tripod and several images are taken of the same view in various lighting conditions. Then you layer the images on top of each other and blend them. If you want to learn how to do proper HDR images in Gimp try Flickr - Discussing HDR in Gimp. You’ll find everything you need there. Or try the Gimp blending exposures tutorial.

But if you are like me and taking wildlife shots you will find that the wildlife generally isn’t too keen on sitting and posing for several hours while the sun moves. Or maybe the local security officer is wiggy about you being parked in front of a building for several hours with a camera. So you only have one image to make it work.

before:

after:

First thing you do is open a copy of your photo in Gimp. ( You know better than to work on your originals right? )

Open up a layers dialog ( Dialogs->Layers )

Create a copy of the layer by clicking on the double image button at the bottom of the layers window.

Hide the top layer by clicking on the eye.

Select the bottom layer by clicking on it.

Go to your image and select Colors->Levels then Auto->OK

This makes your whites whiter and your blacks blacker. Don’t worry about whether it looks ok or not.

Go back to the Layers window and click the eye to make the top layer visible again

Click on the top layer to select it.

Select Mode->Multiply

Now adjust the opacity until you are happy with the image.

On darker images you might find Mode->Overlay works better

Also you might also try adjusting just one color in your color levels. In the Levels box Channel has a drop down menu - you can select all or a color to adjust.

On some images I adjust the levels on the top layer instead of the bottom. You want to experiment a bit and see what works best with your photos.

Another option is to open Filters->Lighting effects and add a light to one layer before blending the photos.

Here are Some excellent examples of HDR
And here are some more to get you motivated.
20 Beautiful HDR Pictures

Use PHP to keep the date fresh on your site

Posted by ljmacphee on February 4, 2008 under how to | Be the First to Comment

I was reading an article reminding webmasters to update the copyright date on their webpages and someone added a note about how to have PHP automatically do this for you.

To show the day of the week:

<?php echo date(”D”) ?>

To show the day of the month:

<?php echo date(”d”) ?>

To show the month:

<?php echo date(”M”) ?>

To show the year:

<?php echo date(”Y”) ?>

That is the code used in the footer at the bottom of the page to show the copyright year.

How to convert your WP Plugin to a WP Widget

Posted by ljmacphee on January 28, 2008 under how to, wordpress | Be the First to Comment

I was asked to convert a Wordpress plugin of mine to a Wordpress widget. It turned out to be a simple process but simple directions were lacking.

You can find examples of widgets as they are meant to be written at the end of the /wordpress/wp-includes/widgets.php file. Use those examples as your template should you have any questions.

Below is a skeleton of a WP Widget. All necessary parts are in this file, all unnecessary ones are not. Start with this and just plunk your plugin code in the section indicated in the comments.


<?php/*
Plugin Name: Your Plugin/Widget Name goes here
Version: 1.0
Plugin URI: The plugin webpage for help and more information
Author: Your name
Author URI: Your homepage
Description: Description of widget
*/
// all functions go in this function this is your main
function your_very_unique_widget_name_badge_init() {
//gracefully fail if sidebar gets deactivated
if ( !function_exists(’register_sidebar_widget’) )
return;
//the code specific to your widget goes in this function
function your_very_unique_widget_name_badge($args)
{ //fetch theme related things
extract($args); // this information is from what the user input in our control function below
$options = get_option ( ‘your_very_unique_widget_name_badge’ );
$title = $options['title'];

// this is where your plugin code belongs all your mysql and php statements go here…….
// ……………………..
// ………………………

//output to sidebar beginning of widget output
echo $before_widget;
echo $before_title;
echo $title;
echo $after_title;

// pretty up and ready the output from your plugin here

//now print output to webpage
echo “<br> $output <br>”;

//clean up - close db if opened etc here

return $output;

}

//user options Be very sure to at least include the option to change the title
// the other stuff is just to show you how to use the checkbox

function your_very_unique_widget_name_badge_control()
{
$options = get_option ( ‘your_very_unique_widget_name_badge’ );

//set initial values if empty or else fetch current
if ( ! is_array($options) ){

$options = array( ‘title’=>”Default Widget Title”, ‘random’=>”0″ );
}else{
//fetch existing choices from user selected options
$title = $options['title']; // title to show in sidebar
$random = $options ['random'] ? ‘checked=”checked”‘ : “”; // ? yes/no ?
}

//clean up and post
if ( $_POST['your_very_unique_widget_name_badge-submit'] ) {

//title
$options['title'] = strip_tags(stripslashes($_POST['your_very_unique_widget_name_badge-title']));

//yes or no selection box example
$options['yes'] = isset($_POST['your_very_unique_widget_name_badge-yes'] );

//save user selections
update_option(’your_very_unique_widget_name_badge’, $options);

}

// This is the form where we collect the user preferences
// Notice that we don’t need a complete form. This will be embedded into the existing form.

echo ‘<p style=”text-align:right;”><label for=”your_very_unique_widget_name_badge-title”>’ . __(’Title:’) . ‘ <input style=”width: 200px;” id=”your_very_unique_widget_name_badge-title” name=”your_very_unique_widget_name_badge-title” type=”text” value=”‘.$title.’” /></label></p>’;

echo ‘<p style=”text-align:right;”><label for=”your_very_unique_widget_name_badge-yes”>’ . __(’Check for random images’) . ‘ <input style=”width: 20px;” id=”your_very_unique_widget_name_badge-random” name=”your_very_unique_widget_name_badge-random” type=”checkbox” value=”‘.$random.’” /></label></p>’;

//Input our form info if user presses save button
echo ‘<input type=”hidden” id=”your_very_unique_widget_name_badge-submit” name=”your_very_unique_widget_name_badge-submit” value=”1″ />’;

}

//register widget so it is available to user in widget page
register_widget_control(array(’Your Widget Name’, ‘widgets’), ‘your_very_unique_widget_name_badge_control’, 300, 150);

<//register control panel so use can see it and use it
register_sidebar_widget(array(’Your Widget Name’,'widgets’), ‘your_very_unique_widget_name_badge’);

}

// go to main
add_action(’widgets_init’, ‘your_very_unique_widget_name_badge_init’);
?>


How to turn your photo into a 3d wood carving in Gimp

Posted by ljmacphee on January 10, 2008 under gimp, graphics, how to | Be the First to Comment

Before:

After:

1) Open a copy of your photo in Gimp
2) Select Dialogs->Layers ( a layer box will open )
3) Click on the copy layer button ( button with two photos on bottom row of buttons )
4) Select bottom layer by clicking on it in layers box
5) Go back to photo and select Filters->Distorts->Emboss ( an emboss box will open )
6) Select Emboss not Bumpmap
7) Click the OK button in the emboss box ( it may take a minute or two for the emboss function to finish)
8 ) Go back to the layers box Click Mode: and select Multiply from the drop down menu
9) Adjust the Opacity in the layers until you are happy with the result

* If you want to see what the bottom layer looks like before adjusting the layers just click the eye button next to the top layer and the top layer will become invisible.

This works better with less detailed photos than it does with more detailed photos.