Grids

CHDK (build 136 or later) allows you to custom design your own composition grids. Small files with the naming convention of filename.grd may be saved in a CHDK/GRIDS/ sub-folder, and called up for use with the OSD Parameters menu option of "Grid Settings".

Grids, like all other chdk OSD elements, do not replace your camera's own grid displays, but are drawn on top of your camera's own display repeatedly by chdk.

Drawing coordinates are all within a 360 (x) by 240 (y) pixel area, Upper-left corner is 0, 0 and lower-right is 359, 239

Any lines which have an incorrect format are ignored. So, you can use comments in the grid-file. I suggest starting comment lines with symbol #, although it is unnecessary.

Color is the color number from current color palette (you can use the Draw Palette command in the Miscellaneous Stuff menu). Also, you can use hexadecimal values (as it is written in palette picker). For example, 15 -> 0x0F, 34 -> 0x22, and so on, but keep in mind that for complex Grid files it is advantageous to use decimal numbers to save space.

'elps' is ellipse, right. x0, y0 - center; rx, ry - two radiuses (See Ellipse; a&b on the picture). If rx equals ry, it will be a circle.

Lines and shapes are drawn in the order they appear in the file, essentially drawing shapes on top of each other. Note that (semi-)transparent colors do not show the underlying shape, but rather the camera picture. This can be used to 'punch holes' into shapes. For example, a transparent circle on an otherwise black background:

DataGhost recently wrote a fun utility to assist in creating grids, as well as adding a feature that was tedious and difficult before, creating grid-shape commands to print small snippets of text on your displayed grid. (See below on the "Authorized-Use ONLY" Grid for an initial use of this utility.)

The program was written in PHP so it needs to run on a server that allows you to execute it in the proper environment. DataGhost has been kind enough to also host it on his own domain so that you may run it right in your browser, as well as provide the GPL licensed code so that anyone may put on their own server for personal use.

A few things you should know about using it that will help you to get the most out of it.

Keep text strings short. You have approximately a 3886 byte limit (does anyone know the exact limit? 3990 was too high) for your Grid File, otherwise parts of your grid will not get displayed, they are just simply not read beyond that byte limit. If you see missing lines or bits of characters missing in your displayed grid file, go back and tweak your text or its position to get that byte count down. Be aware too that upper-case and lower-case of the same characters can also alter how many lines of code each uses. Example: "a" may require more lines of code than "A", the caps character being a simpler design to render. Experiment.

To get more text on the screen try using smaller fonts, and trying to keep them in the upper-left corner of your display. This keeps them from going into 3-digit X/Y coordinates, greatly diminishing the number of bytes used up for each grid-command line.

Use any of the color codes from 1 to 9 if possible, this too keeping each grid-command line a byte or two shorter.

Using the above tricks to keep the byte-count down I found it was possible to create a grid that displayed "Return to: (my address & phone-number)" so that when traveling you can leave that displayed in your viewfinder in case your camera is lost or stolen (when you're not using it that is). Use short lines, abbreviate where possible, and put returns on each line so it keeps it all in the upper-left corner for smaller coordinate position numbers.

If you want to use the feature where you can upload a PNG image and have it try to do a simple raster to vector conversion, keep in mind there is a ratio variance between the grid drawing area and your actual EVF/LCD display. The grid being drawn in a 3:2 aspect ratio, the EVF/LCD in a 4:3 aspect ratio. If using a graphic editor to create your simple design: start out with a white background 360x270 pixels. After you are done drawing your line diagrams/grid-lines in black, then resize that image to 360x240, making sure you have "Keep Proportional" turned OFF. Then when you submit your graphic image to the Text2Grid program, it will render your square images in the right proportions so they look square in the EVF.

There are some limits to how well the graphic to grid file conversion works. Here is what DataGhost had to say about this issue: "... this script only works well for horizontal and vertical lines. A circle will be converted into a bunch of (1-pixel and slightly longer) horizontal/vertical lines, a diagonal line is even worse (1 line per pixel)" This means you can't go overboard and hope for complex shapes in your Grid file.

The default use was to print white text on a full black background. Adjust the background to 0 (clear), or just remember to delete the very first line of the resulting grid file to remove that full-black rectangle background.

Mostly this is an excellent program to create the code needed for small text-tags and things of that nature. With the added capability of rotating your text so you may align it with a border-line on either side of your screen. A fun tool to help convert your grid-idea to an actual grid file. While it may not render the exact shapes from a submitted PNG image, it will at least pick out the main coordinates where you can then use them to simplify your grid using the standard rectangle and line commands.

If anyone would like to go through all the cropping grids (below) and put a little X:Y text reminder, examples, 10:8 or 7:5, in an unused corner of each (as an add-on for each grid), please do. This would be an excellent use for this tool, so you can see right in your viewfinder exactly what cropping-grid you have loaded and are using at the time.

The 3:2 EVF/LCD dimensions do not correlate exactly to the 4:3 dimensions of the actual image You might, or will, have to adjust your cropping areas and guidelines accordingly. The easiest way that I found was to take an actual image taken from the camera and loading it into PhotoLine 32 editor. Then create a "lasso" in the exact proportions required (typing in the ratio in the lasso's tool options), and clicking on "proportional". Create a lasso to fill up the image from one border to another. Then create a new layer from that lasso (tool > lasso > convert layer to lasso), so I could see the new dimension outline when downsized. Downsize/Scale the whole document (not just a layer) to the dimensions of 360x240 with proportional OFF. Then measure how many pixels are left between the lasso layer and the original image's borders with any tool that shows pixel dimensions when used. That will be the amount to subtract from the corresponding EVF/LCD display borders.

This layout expands on the more simple demo golden-ratio grids, based on the Golden Ratio. A composition discovered millennia ago concerning the most pleasing and universally natural shape. The age-old subject composition "rule of thirds" was taken from the Golden Ratio as an easier (though inaccurate) way to approximate it. This grid adds in the triangular ratios for all 4 corners as well as a smaller subset of spiraling rectangles denoting lobes of a golden-spiral. Suggested filename: "golden3.grd". The colors were chosen for an S3 IS, you may need to change the colors for yours. I left spaces between each batch of lines being drawn, each section being upper-left, upper-right, lower-left, and lower-right, in case you want to tweak them for position or color, it'll be easier to find each section. The blocks are: tic-tac-toe grid (4 lines, color 0x07), golden-triangles (8 lines, color 0x27), and then the spiraling rectangles (16 lines, color 0x05).

Sample image:

For an even more interesting and multi-purpose composition aid you might want to append the "Rulers Grid" lines to this one. Though the display might be much too busy for most people's tastes. (I just found out that I like it and it is now my new default. All colors in my grid definitions are transparent so they are much less obtrusive in actual use than the example images here appear at first glance.)

I tried adding in a golden-spiral to the above grid to see how it might help for some unique nature compositions, but it became a bit too much to have it all displayed on the same grid. If anyone is curious to see how a Golden-Spiral relates to the Golden-Rectangles and Golden-Triangles in the above (and don't care to do all the hand-plotting like I did), just append the following commands to your GoldGrid.grd file from above. It only displays one orientation of the 4 possible orientations, but you should be able to visualize how the 3 other positions would be oriented to the pre-existing rectangles and triangles.

These grids are combinations of the golden ratio basic lines and the 3x3 grid, also as lines. The 3x3 lines do not intersect the GR lines, so the ruler can still be used in this one. The ones I'm posting here are the same and they are both visible in any lighting/color condition. To accomplish this, the lines are 2 pixels thick (effectively) and are black and white. If you want just one (transparent) color, remove the black lines and change the color of the white lines.

The first one is the simplest one, though because the lines intersect, some pixels may blink. If this is annoying, use the second one.

For borderless printing on standard letter-size 8.5" x 11" (typically labelled 8x10) photo paper. If you frequently print borderless 8x10 photos then this is the minor framing change that's needed to take advantage of every bit of printable area on this common paper size. This crop proportion can also ensure completely symmetric white borders when printing with margins.

In the past when using another digital camera for taking moon and aurora photos, or trying to get long exposures of constellations, I was frequently annoyed by how very bright the EVF display could get once my eyes became dark-adapted. Even though that camera has 3 levels of brightness to choose from, even the dimmest setting was way too bright. I even went so far as to custom-grind a glass ND-16 filter to fit into the eye-piece cup on the other camera. So I thought I'd try to see if the filled-rectangle grid function might help in this regard with Canon cameras. There's no guarantee this will be any improvement, I've not tried these for actual use, but after some short inside visual tests it appears these might actually help. You will of course have to turn off all your other On-Screen Display (OSD) items so they don't provide brighter areas, and turn down your EVF/LCD brightness to the dim setting to also help. When these grid files are on all your camera settings will not be visible except for very brief flashes while actually changing them. So that seems a plus right there. Anyway, see if these help:

For this one I just chose the darkest transparent gray I could find:

@title Night-vision Protect
@rectf 0, 0, 359, 259, 0xf8, 0xf8

And this one uses the darkest transparent red out of the available palette colors:

@title Night-vision Red
@rectf 0, 0, 359, 259, 0x42, 0x42

Horizontal Halftone Pattern (On mid grey background)

I'm now wondering if a half-tone grid where every other line is black might be a better route to try. I'm just reluctant to type 120 or 180 lines of graphic commands for an experiment. :-)

I wanted to play with the elps and elpsf functions to see how they worked. I first tried putting 2 clear circles over a full black rectangle, but it seems the "fill" functions override any previous fill-colors chosen. The clear-filled circles on black made the whole image clear. So instead I went with 2 unfilled circles, and then used 2 transparent filled-circles to try to remove the intersecting arcs between them. Well, it sort of works. :-) As the grid is drawn the filled ellipse shapes momentarily show the intersecting arcs. I even tried the half-tone grid above, putting 2 clear circles over that, that too was interesting, they alternately flash as clear and half-toned. :-)

p.s. I first thought the rx, and ry commands where for the foci of an ellipse, and found out that if you put the ellipse commands out of bounds that it locks up the camera pretty bad. I had to remove the batteries to get it to shut down. And then delete the old ellipse test-file so it wouldn't auto-load and lock up on boot-up.

Anyway, here's a binocular mask for those of you that might ever do a novelty mask for a photo and want to make sure your subject is in the mask's FOV:

Hint: To get a circle look like a circle with the 4:3 / 3:2 offset, just take the X radius and multiply it by 8, then divide that result by 9, to get a proportional/equivalent Y radius.

Anyone want to do the cutesy heart-shape that so many want as a mask over their wedding photos? :-) I suppose it wouldn't be too hard to do. Just make the clear-filled circles for the heart lobes offset to the bottom to erase the bottom half of the circles (like I used them to erase the intersecting arcs in the binoc-mask), and 2 lines for the apex of the heart. Could be done with about 20-30 short line segments too, making a better shape. (I did that to make a golden-curve for the golden-grids one, but it became too messy/cluttered all on the same grid display.)

Something that has always bothered me about this "novelty" grid, is how slow it refreshes the EVF/LCD display. Interfering in any Zebra or other OSD display elements when loaded. I guess this is due to how long it takes to compute the circle/ellipse shapes. Well, it was raining today, I was bored, and thought I'd tweak the speed by removing the two transparent circle commands (erasing the opaque-circle's intersecting lines) and replacing it with a easier to compute transparent rectangle just large enough to erase the intersecting lines. The intersecting lines still flicker, but now much faster. :-)

Granted, this design probably has very limited use, but ... as I said, I was really bored. :-) By doing this the info and method might come in handy for others wanting to design complex grids with circles and ellipses in them that want a faster way to erase partial arcs. Though, I have to admit, it would probably refresh fastest of all if short line-segments were used to define your arcs and curves (as in the golden-spiral grid). I detect none of this draw-delay flickering in any of the more complex grids with many dozens of little straight line-segments. Though it would take a lot longer for the grid designer to convert their curves to those more multitudinous line commands. More time spent by the designer would equate to faster refresh-rates for all. Just another notch to add into the knowledge-base about grids.

I got this idea from one of the Nikon focusing screens. One of the models that allows high-speed burst modes in a reduced resolution, while still showing the larger full-frame size in the viewfinder.

This grid was designed around the available image sizes of an "S3 IS" camera. When shooting in highest resolution of "L", 2816 x 2112 pixels, this grid displays the cropping areas as if you were using the "M1" - 2271 x 1704 pixels, the "M2" - 1600 x 1200 pixels, and the "S" - 640 x 480 pixel image sizes. This way you can view the full-frame in the viewfinder, but plan ahead for cropping to one of the other available resolutions. You can then watch for any activity outside of those image-resolution boundaries and be better able to follow any fast action in your viewfinder that might be entering or leaving the final-crop image area. One more pair of lines was included to show the "W" - 2816 x 1584 wide-angle FOV so when planning to crop for that resolution you can still watch for activity above and below your final image area, instead of just blacking out those areas as the camera normally does.

If other camera-model owners find this idea useful, please feel free to share your sports-finder resolution crops for the available resolution sizes in your camera. It is worth noting, that even a 1600 x 1200 resolution image will still print quite nicely even at 7"x5" print size. So for that little-league game this might be just the thing you need for following the action and still having photos to print out for relatives and friends.

Fashioned after another focusing screen grid found online. The area is divided up into an 10x8 composition (the 2 far side lines), and the 10x8 wide dimension further horizontally into fourths. The top and bottom lines defining a square off of those 4th-divisions. Further a circle was added tangent to the square.

Fashioned after some aerial-photography and photomicrography grids. Horizontal and vertical rulers bisecting your FOV. Divided horizontally in 4 units of measure and vertically in 3 units of measure. With half and 1/10th unit tic-marks. May come in extremely handy for macro-photography when trying to keep the subject size the same in landscape or portrait orientations. Or when comparing subject size to one another when reframing or refocusing. (I like this one so much that I now use it as my default.)

Following is a Ruler's Grid "add-on". I wanted to put little cross-hairs at the half and full unit intersections in the clear areas and at the borders. When all combined it would be a nice grid. But I ran into a snafu. When these cross-hairs lines below, are appended to the ruler tic-marks above, I ran out of memory for them and only about 2/3rds of the cross-hairs get displayed. I might be able to display them all by removing the border cross-hairs. In case you want to do this, they are written in batches of 8 cross-hairs, starting top-left and going to top-right, then down to the next row. But I'll leave the full tic-mark grid here intact in case you want to use it "as-is" as a stand-alone grid file, or to use a subset of them to add into the Ruler Grid above.

Maybe it would work if I got rid of all unneeded spaces and line-feeds? I'll see what happens. (editing time passes) Hey! It works! Throw the two files together in an editor and delete ALL spaces and all double-returns. It only fails to display 3 cross-hairs in the lower-right. So close! ... :) Okay, I got it to work. I changed the HEX color codes for decimal codes too. Seeing as how this takes a decent editor to do this, I'll post the full Rulers + Cross-hairs Grid below.

Update 1: The cross-hairs were reduced to 3/5ths their size in this file. The larger sizes above (in the original format) were too obtrusive, I thought.

Update 2: The colors weren't to my final liking. The rulers are now marked off in transparent green and the cross-hairs are in transparent blue, with transparent purple for the 1-unit intersections. These colors were chosen on the S3 IS camera, your camera's colors may vary. If you need to edit them the final value on each line is: 5 = transparent green, 7 = transparent blue, 39 = transparent purple. Or you can always use the OSD Parameters > Grid Settings > Override Grid Colors > Line Color options to change them as needed without any editing. (Note, this override will change all line colors to this setting, rulers and cross-hairs included.)

Have you ever been at some gathering where people think it's okay to just pick up your camera to fire off some photos or just play with it to see through the lens? Or do you fear your camera will be stolen and the thief will benefit greatly from his act? I just got the idea that a little grid file might be just the thing needed. All this does is black out your viewfinder. Making it look like your camera is busted. With other OSD elements displayed, like histogram, it will flash the histogram between being blacked out. Still looking like your camera is trashed. Only someone familiar with the menus and workings of CHDK will be able to figure out what's going on. All you have to do is disable the OSD display with the short-cut keys or load another grid when you're ready to use your camera again.

Next time you are around a bunch of people that aren't respectful enough to "Ask first!", load up this little grid file before setting down your camera. See if it helps. :)

Suggested filename: auth_use.grd

@title Authorized Use
@rectf 0,0,359,239,0xFF,0xFF

You of course could expound on this by using other graphic commands to also print out a nasty message. :) Or maybe even your name and address when traveling. The first time a thief boots it up that's all they'd see and not know how to get rid of it. It might eventually fall into the hands of someone that would return it.

(Suggested traveler's Grid: Black screen with, "This camera is STOLEN! Return to ..." It would take some work to do all that text with the grid commands, but it could be done. Does anyone have a simple utility to convert text to graphics commands?)

Come to think of it, this would be an excellent feature built into any camera. You can only unlock its use with your personalized key-sequence. Camera makers should incorporate this. Anyone that gets a camera with "STOLEN CAMERA" in the display will know they are buying tainted goods.

Update:

DataGhost just recently wrote a wonderful little utility for Grid designers. It takes any text and converts it to grid commands. There is a limit to just how much text you can input, but it works great! I don't know if he'll release the link to that online utility or not for public use, I hope so. Then you'll be able to write your own message on your grids. (I want to now use it to include small ratio reminders on some of the multi-ratio grids.)

This grid is based on ISO/IEC 19794-5:2005[1] values required for administrative identity photo (passports, identity cards, driving licence...). A large red face shape represent the maximal size accepted, whereas the smaller green shape is the minimal sized allowed. A grey area represent where eyes have to be. A vertical axe and two horizontal rulers should help for positioning the subject. The picture has afterwhat to be resized to 35 x 45 mm before beeing printed. The best is to make a composition of 6 (2 lines, 3 rows) photo on a 10 x 13 cm format or 8 (2 lines, 4 rows) photo on a 10x15 format. It is to be noticed that the reprint should be done by a professional, not by your personnal printer...otherwise it might be refused by the administration staff.

I needed a little work to understand how grids functioning.
At first I was looking for a picture on the Internet and brought it down to size 240 x 360. From this I have determined the coordinates for the lines and ellipses. I have also tried to convert the equator and the tropics and the polar circles halfway real.

But a test in my IXUS 850 IS did not showed all. Version 1 did not work. I went to troubleshooting, and soon found the cause. The .GRD files can not be larger than 3886 bytes. This is a problem.

So I had to start saving. As a first thought all unnecessary lines and comments were deleted. Unfortunately this was not enough. My second thought were blanks and tabs. A test showed me that these were not necessary. The colors in hexadecimal were too long. These were then converted to decimal. How a test turned out it is not possible to shorten the commands. There was more necessary. The carriage return! That was a possibility. A quick test showed me the Windows CRLF line break was not necessary. The Linux-LF line break was enough. Without them there was no way. It took me even more. Again the colors. I now use only colors from the range of decimal single digits. Again, a small saving. The savings will now be set to maximum. That's all I think what is possible.

Finally earth is too big to use as grid.
Seek out of the entire portfolio what you need and have fun with it!