Wednesday, June 11, 2008

Working with the Raw Files from CHDK

By default, the Powershot S5 IS does not provide raw file output functionality. Because of that, the files generated by it are very unique. Commercial software like Photoshop, Paint Shop, or Capture One, just as a few examples, can not directly open the raw files. This is because in order to open a raw file generated by a camera, the software manufacturer either receives the profile for the format of the raw files for that particular camera (each camera individually has it's own raw profile and generates a unique raw file) or in rare cases, reverse engineers the raw file to get it's profile. But, the camera has to normally provide the functionality of outputting raw files without additional components or software hacks, otherwise, those companies see no reason to include its profile in their software (not everyone uses CHDK).

There are a few ingenious people who have reverse engineered the raw file the S5 outputs by CHDK and provided a software program that will convert the output crw files to DNG. DNG or digital negative is a file format developed by Adobe systems as a more universal format for working with and storing raw files. Regardless of the camera model or make, a DNG file is always loadable by most software like, of course, most of the Adobe line of image editing software and other programs that can open DNG files. The format was intended to be more ubiquitous and standard than the files from cameras alone. Especially since every camera has its own format for its raw file regardless of manufacturer or model. This made it difficult to work with raw files from cameras and it wasn't always guaranteed that the existing software you own will open it. This prompted Adobe to develop their DNG format to convert to from the camera's raw format. But, because the S5 does not normally output raw files, Adobe won't have its file format profile and cannot convert to DNG. How do you convert it?

There is a great program called DNG4PS-2 which was developed for free to convert the crw raw files from the canon powershot line of cameras to Adobe digital negative format for use with typical photo editing software. The software can be found here;

(Version 0.2.2 (beta as of this writing) is multilingual, any version earlier than that is Russian only)

The initial screen for DNG4PS-2 is somewhat underwhelming, but functional.


The Path to RAW files is a perpetually configured option in that each time you dump the pictures from your camera to your computer, there will likely be a new folder that they are stored. As a result, you'll need to configure it each time. The list below that shows the raw files it's detected and any corresponding jpg files. The S5 cannot save only jpg files, though, if you delete the jpg files through the review menu on the S5, it won't erase the corresponding crw file (it doesn't know to delete them since it normally doesn't make them), basically making the camera raw only. However, there is a benefit to having the corresponding jpg file as it is used by DNG4PS-2 as a profile for the raw file conversion effectively developing it. If the jpg is missing it will use a default profile. The DNG output directory is just where you want the resulting DNG files to be saved.

Clicking the Setting button shows the following dialog.


The main settings are self explanatory. The DNG files options includes options to compress the DNG file for smaller files, but I'm not sure how compatible they would be with non-Adobe software. Add metadata from jpeg file means to add and maintain any exif and ipc data contained in the jpg files. This can only be done if a corresponding jpg file is preserved when the photo was taken and copied to the same folder as the crw file when dumping the photos to your computer. Insert preview allows you to insert the jpg file as a preview to show what the contents, though not exactly the photo, since it is a copy of the jpg and not the crw, would be. You can adjust the size accordingly. Subfolder allows you to specify that the resulting DNG file be saved to a subfolder named by the date stamp from the crw file. Keep in mind that CHDK sometimes goofs up the date stamp for crw files and DNG4PS-2 may create more than one date folder as a result. Artist is just the artist name and is inserted into the exif data. Camera types allows you to specify the camera profile for each megapixel type. Regardless of the setting of the S5, the raw file wil always be an 8 megapixel file. Therefore, dropdown the list and choose the S5 for the 8 Mpx profile. Set the interface or program language to your preferred language and press okay.

When you click convert on the main dialog, the following display shows.


Once completed, you can work with the resulting DNG files as you wish. If you've included a preview, depending on the size, you may notice that the resulting DNG file is significantly larger than the original crw file.

Quote of the day:
Nothing is impossible. Some things are just less likely than others. - Jonathan Winters

Sunday, May 4, 2008

Interval Shooting (Script Based)

Using the built-in scripting feature of CHDK, some interesting results can be had by executing a script for something specific. In this tutorial, I will attempt to go through the process of using an interval or time lapse script.

Be sure you have the INTERVAL.BAS script. If you don't, download it here: Sample Scripts (just download the file mentioned above for now)

  • Open the <ALT> menu and select Script Parameters to begin. Select Load script from File...
  • When the file browser opens, select the INTERVAL.BAS file.
  • When the script parameters screen returns, it will show the parameters that the loaded script requires in the bottom section of the screen.
  • Shoot count - This is the number of photos you want taken. I personally don't recommend setting up the camera to do things like photographing the entire lifecycle of a flower for example, because this is taxing on the batteries.
  • Interval (Minutes) - This the the number of minutes before the next shot. Leave as 0 if you only want to use seconds.
  • Interval (Seconds) - This is the number of seconds between shots. Since, by the screen above, I have 10 shots every 10 seconds, I will need to leave the camera for 1 minute and 40 seconds (100 seconds / 60 seconds = 1 min 40 sec).
  • Press menu to return to the main screen, but do not press the alt button as you'll want to be in <ALT> mode. You will see the name of your script at the bottom of the screen to the left of the <ALT> word. Press the shutter to begin executing the script with the given parameters.
  • Every 10 seconds, the camera will take a photo automatically. It is also good to note, it will use the current settings of the camera. If you were in manual mode and had the shutter speed set and the aperture set, it will use those settings.
  • At anytime, if you need to stop the script from executing, you can press the shutter again and it will stop.

I hope this tutorial helps, and feel free to post questions in the comments area below.

Quote of the day:
When I was younger, I could remember anything, whether it had happened or not. - Mark Twain

Tuesday, April 29, 2008

RAW Parameters Explained

RAW File options

Save RAW

This is a toggle that allows you to enable saving to a RAW file. RAW files for our camera (S5) are 10.1 MB in size and take an additional 2.5 seconds to save each time the shutter is pressed. I recommend only enabling it when you need it.

Noise Reduction

This option allows you to specify noise reduction on, off or auto. When on, the program grabs a picture of a black screen it generates and uses that to filter noisy pixels in the image. Auto tries to decide if it needs to, and may be based on ISO setting.

Only First RAW in Series

This option allows you to specify whether just the first photo in a continuous shooting mode generates a RAW file or if all of them do. If this option is enabled, continuous shooting speed is greatly reduced. This also affects the bracketing shots.

RAW File in Dir with JPEG

This option, when enabled, saves the RAW file in the same folder as the JPEG generated by the camera. This allows you to easily find the RAW file. If disabled, it saves all RAW files in one folder.

RAW File Prefix

The text to prefix the name of the RAW file. This does not affect the file internally and can be set to anything available in the list.

RAW File Extension

The extension of the RAW filename. CRW and CR2 are standard Canon RAW file extensions, whereas the others are there as options. CRW is an old Canon RAW extension name and CR2 is the 2nd version of the RAW format.

RAW Develop

This option allows you to specify a RAW file to generate into a jpg file. A file browser will show, select the CRW file you'd like to develop, press set and take a photo (it doesn't get saved). The settings of the photo you took will be applied to the CRW and saved to a jpg file that you can view on camera.

CHDK Scripts

Though CHDK provides a robust set of tools out of the box, some things it provides are best left to scripting for greater control and customization. That said, using the scripting functions is a simple process and can prove to be invaluable. You can do bracketing (the camera, by default, only allows a maximum of 2 EV's and 3 shots), motion detection, and more. Below is a tutorial on how to load a script, set its paramters and get it going.
  • To get to the scripting, select scripting parameters from the main menu;
  • The main script screen always shows the last loaded script and its parameters in the last section;
  • To load a script, select Load Script from File;
  • A file browser opens to allow you to select the script file. The scripts are a loose similarity to BASIC and therefore have a .bas extension. The ~1 in the files are just because the filename is too large, so it shortens it;
  • I selected the MD_TEST2.BAS file. This is a motion detection test file;
  • Once the file is loaded (by pressing SET on your camera after selecting the file), the main screen returns and shows the parameters required as defined in the script itself. Set the options as desired (a tutorial on motion detection to come soon), then press the menu button on your camera. You'll notice it shows the script name in the bottom left of the screen (in rec mode, not shown in playback mode). Without exiting ALT mode, press the shutter button to execute the script and it will run;

CHDK Menus

  • Boot screen:
  • ALT mode:
  • Main Menu:
  • Operations Menu:
  • Bracketing in Continous Mode:
  • Custom Auto ISO:
  • OSD Options:
  • Grid Lines:
  • Misc Values 1:
  • Misc Values 2:
  • DOF Calculator:
  • RAW Showing Settings:
  • Battery Showing Settings:
  • File Showing Settings:
  • Clock Settings:
  • RAW Options:
  • Histogram Options:
  • Zebra Options:
  • Script Options:
  • Visual Settings 1:
  • Visual Settings 2:
  • Miscellaneous Options:
  • Text File Reader:
  • Games:
  • Debug:

Installing CHDK to your S5 (1-4 GB SD Cards only, not SDHC)

  • Download CHDK from CHDK for S5 Downloads and save it to your desktop for easy access.
  • Download the file to make your SD card bootable for the camera.
  • Format your card in your camera to clear it off.
  • Remove your SD card from your camera and insert it into your card reader on your computer. This won't work if the card is left in the camera and the camera connected. The card must be removed.
  • Unzip the bootable.exe (you can ignore the .c file) to your card. Also, note the drive letter for your card.
  • Start a command prompt by going to Start/All Programs/Accessories/Command Prompt. Navigate to your card's drive letter by type the drive letter, a colon and press enter. (ie. f: <enter>)
  • Type bootable [drive]: where [drive] is replaced by your card's drive letter.
  • Now your card is bootable for the camera.
  • Extract the DISKBOOT.BIN file to your card. Do not extract it to any folders on your card.
  • Remove your card from the reader and make sure you slide the read only switch on the card to read only or lock.
  • Reinsert it into your camera and turn it on. If you see a blue box pop up and extra information showing on your screen, you've done it correctly.