Showing posts with label photo-editing. Show all posts
Showing posts with label photo-editing. Show all posts

Thursday, February 01, 2007

How Big is your Image File?

Okay, not intended to be a personal question. Over on one of the Yahoogroups I frequent, Power Team, there's been a discussion related to the groups filled-up photo albums, and what to do about it. I made the statement that most people don't care to learn the technicalities of managing the size of their image files. Somebody called me on it, so here I am, giving you a chance to learn a little more about this esoteric subject, if you're interested.

Fact is, the issue of image sizes is often counter-intuitive. We're used to "megapixels" as marketing speak, but most of us have very little idea how images are stored in our cameras (and in turn on our computers), or why a picture from one 6-megapixel camera can look much better than another 6-megapixel camera.

Okay, I don't intend to get side-tracked into a camera discussion, but if you follow and understand what I tell you here, it does apply to your camera and may help you better understand how to use its features.

I'll try to keep things simple and non-technical, and that means (for you techheads out there) that I may make some simplifications and generalizations about things. Just relax and cut me some slack. If what I say here isn't always absolutely true, most of the time it's true enough.

As I said, the number of pixels that a camera can detect doesn't always translate into a better image. Likewise, two images on your computer of the same absolute size (say 800 pixels wide, and 600 pixels tall) may have much different file sizes. In both cases, the major issue is something called file compression.

Okay, you've probably noticed in one way or another that image files take up a lot of memory (space on your camera's memory card, space on your hard disk, and so on). What you maybe don't know is that it could be much worse. Almost every image on your computer and in your camera uses some form of compression to make it smaller than it would be otherwise.

What is an image file?
To understand how an image file is compressed, you need to understand first what an image file is.

I used the word "pixel" back there and took it for granted that you'd know what I was talking about, but I'm not sure that's a safe assumption. In general terms, a pixel is a dot. Each dot has characteristics of color and brightness that are recorded in digital form (those ones and zeros you keep hearing about, which can be ignored for our purposes) on your camera or computer. Depending on the type of file and the options chosen, various amounts of information can be stored for each pixel.

The simplest kind of image just has two conditions for the pixel, on (white for instance) and off (which could represent black). But in this day and age, it's rare to see an image that doesn't have color. Some images have just a few colors available. Most photos have a LOT.

Think of it as box of crayons. If you have a box of eight crayons, you're pretty limited in how realistic a picture you can draw. If you have 256 crayons, you'd be able to draw a better picture. Well, many of the images you have on your computer have tens of thousands of crayons to chose from, and most images will use a fair percentage of those. The more crayons you've got, the more information has to be recorded to show which crayon is used to draw any given pixel.

So in basic terms, an image file is something like this.

Pixel 1 (Starting in the upper left hand corner): Pixel 1 is color 11,320 from our box of about 32,000.

Pixel 2 (the next pixel in the top row, but one to the right of pixel 1): Pixel 2 is color 11,321 from our box of about 32,000.

And so on, repeated (in our 800 x 600 example image) 800 times, until we skip down to the left of the second row, and repeat, the whole process repeating 600 times until you reach the bottom right of the picture.

So in a raw, uncompressed file, file size is pretty simple. It's the amount of space each pixel takes up multiplied by the number of pixels. Two pictures of the same size will be the same size, no matter if one is of a blank, white, wall, and the other is of a forest. That's simple, but it's wasteful of storage space, and as I said, image files are inconveniently large. Anything we can do to make them smaller is a good thing. But how do you make the file smaller, without making the image itself smaller?

Squeezing it Down

The funny thing about pictures is that, while a picture may have a lot of pixels, in many images a lot of those pixels are in patches that are exactly the same, and if they aren't the same, they're darned similar. For example, image a picture of your favorite GI Joe sitting on a table outside. Below him is grass and other "ground clutter," but behind him is a clear, blue sky.

Imagine looking at a pixel in the middle of that sky. Let's just call it's color, "blue." Maybe the next pixel to the left is the same blue, and the one beyond that just a TINY bit lighter blue, and the next beyond that back to the original blue again. In fact, you could go a fair distance in any direction from our pixel, and no be able to find a color that was much different than that original pixel.

Sure, some of them are different, but most are so close that they're difficult or impossible to tell apart with the naked eye. If you can't tell them apart, then the computer (or camera) is wasting a lot of space storing information that really doesn't serve much of any purpose. A computer (or the software built into a camera) could look at those similar colors and decide they were too close to tell apart, and set them all to one, average color.

Having turned a bunch of almost identical colors into really identical colors, imagine that, instead of storing "pixel 1, pixel 2, pixel 3" we could instead store "starting 100 pixels from the left and 120 pixels down there's a rectangle. It's 150 pixes tall and 500 pixels wide, and all those pixels are color 11,320 of around 32,000, AKA 'blue.'" We just defined 50,000 color pixels with one sentence. In computer terms, we just saved a butt-load of storage space.

Okay, now imagine the software takes your entire picture and divides it into a whole bunch of rectangles, and defines each one in the same way. Some of those rectangles, say a piece of blue sky, or a white-washed wall, or the big yellow side of the Mobile Support Vehicle may be pretty large, and defining them will save a ton of space.

But other rectangles will be smaller, say the skin on a cheek between the eye and the crease around somebodies mouth, or the middle part of an orange on a table, or the white in a little patch of cloud floating in that blue sky. Defining those areas will still save space, but not nearly so much. It may take just as much storage space to define an area 10 x 50 pixels as it does for one 100 x 500. Some places on the image, in a bed of gravel, or a patch of grass, or in the leaves of a tree, or in uncle jack's herringbone sports-jacket, the rectangles may get so small that it isn't worth making them at all. You'll do just as well to record the individual pixels.



It's easier to see how this works if you look at an image that's been over-compressed to the point of looking "jaggy." Like this one. You might want to click on it for a closer look. Notice that a blue sky isn't just ONE shade of blue. There may be hundreds of shades in the original image. But maybe you can turn it into ten or twenty shades, and your eye usually won't notice. Even in our super-compressed example here, there are still four bands of different blue in the sky, but obviously you do notice.

Notice the smaller blocky areas of the same color, the parts of his uniform, the table he's sitting on. Then look at the really "noisy" parts of the image, the grass, his his detailed boots, the rocket launch pads in the background. Of the total image size here, very little of it is that blue sky, or the white table top. Most of it is in those "dirty" areas. Life is in the details. So is file size.

Most cameras, and most photo editing programs on your computer will somewhere have options on how aggressively to compress images. More compression lowers quality, until you eventually get the "paint-by-numbers" mess you see above, but less compression means bigger file sizes. There's a happy sweet spot somewhere that you can live with. Generally, I go for less compression on the camera, but more compression when I save things for uploading from my photo-editing software (Paint Shop Pro, in my case). As long as you keep the original, high-quality images from your camera, you can then create all the cropped and compressed copies you need. The original is still there if you ever need it.


Dirty Details

So compact image sizes start in what you're taking pictures of. That doesn't mean you should never take a picture with grass or a tree (or your rough concrete driveway, or your hardwood floor). If that's part of what your picture is about, then do it. It's hard for the Adventure Team to have a jungle adventure without the jungle, for example.

But if, on the other hand, you're taking a picture of something to sell on EBay, you may not want to photograph it against you pin-striped sheets or sitting on top of your jelly-bean collection, because that isn't what the picture is about. All that clutter in the background is just wasted file space.

Bringing in the Crops
One easy way to reduce the file size of images before you upload them is to crop unnecessary stuff from the edges. Figure out what the picture is about, and cut off the rest. Yes, a well composed image is going to leave some open space around the subject, but when in doubt, crop.

The point here is not just to make the dimensions of the image smaller, though you'll probably do that. The point is that often the most "noisy" parts of an image (and thus the hardest to compress) are on the edges. For instance, in a picture of an action figures standing in the back yard, do you really need all that grass on the bottom of the picture? It's kind of a law of nature. Gravity pulls clutter down to the bottom of the picture. Nature grows it up on the edges (plants, trees, mountains), and the atmosphere sometimes tosses it in at the top (clouds). The action figure or vehicle in the middle of the picture may be the easiest thing in the frame to compress. Cut off ten percent of the grass at the bottom, and you cut off thirty percent of the file size.

Size Does Still Matter
I said that image size was not the biggest consideration to file size, but it is still a consideration. Just because your camera can record 5 megapixels doesn't mean you necessarily need to share them all with the world. In fact, if the intent is for people to look at it on their screen, the vast majority of that information is just going to be wasted.

If you learn nothing else, learn how to use your photo editing software to resize your images. Remember that you'll probably want to save the reduced-size image as a separate file, and keep your camera original untouched. Once you lose that information by saving a downsized image, you can't get it back. Yes, your paint program can resize the smaller image back to the original size, but it will end up looking like our blocky example about, and not your beautiful original.

How big should your images be? Well, probably no bigger than your average viewer's screen, and probably not even that. Remember that most web browsers clutter up the screen with scroll bars, menu bars, and so on. You just get the smaller space left in the middle. I'd say that 800 x 600 is a good "big" image size, and that many images can be much smaller. Remember that if you've cropped your image as I said, many will be tall and skinny, and some will be short and wide. Just resize it so that the width is no more than about 800, and the height no more than about 600, and you're pretty safe. Much larger than that is wasted on most people's screens, unless you think they'll need to be able to zoom in to view details for some reason (as might be the case in a "how-to" illustration, for example).

Reducing the size of the image, even a little, can be more important than you think. The information that makes up an image grows much faster than the linear dimensions do. For example, a raw 500x400 image doesn't have twice as much information in at as one 250 by 200, it has four times as much. A 1000 x 800 image has 16 times as much information as one 250 x 200, and so on. Compression can offset that to some extent, and usually does, but when you can, smaller is better.

When creating web pages, a common mistake is to confuse options in your web editing software that set display sizes for actually resizing the image. That is to say, somebody will upload a 5 megapixel camera image to their web site, and then tell their web-page editor to display it as a 100 x 200 pixel image on the user's screen. But they're still storing the full 5 megapixel image on their site, and every user who views the site his to download that huge file (with the bandwidth use that goes with it), even though it only displays as a tiny picture on their computer.

Always resize the image using a photo editor program to the final size, then upload that file to your web page.


Goes Down Smooth (for advanced users)

One other trick to reduce image file sizes is to remove some of the random noise that appears in images. Some of this noise can come from "grain" in the image. Noise like that can turn an empty sky or a solid color wall into a compression nightmare, but not add much of anything to the image. Likewise, all those pores and tiny wrinkles in your portrait are not only making you look old before your time, they're also making the image file way bigger.

One way to reduce this noise is simply to soften or blur the images, like when old Hollywood movies used soft-focus lenses to make aging actresses look better in close-ups. You can try this (usually using editing functions in your photo-editing software, not by changing camera focus), and there are sometime reasons to do it, but often this is throwing the baby out with the bath-water. You not only blur the solid areas of the image, but the lines and borders that separate them.

Some photo-editing programs have ways around this. For example, Paint Shop Pro has a function called an "edge preserving smooth." This effectively blurs the solid areas of an image that may contain useless noise, while keeping the lines and edges crisp and solid. It can take out your wrinkles and pores without turning your nose into a blob or your eyes into smudges. It can smooth the sand on a beach but still leave the ocean horizon a razor-sharp line.

The more creative among you may want to consider more labor-intensive methods, manually retouching parts of a picture, or selecting areas to blur or soften, but that's beyond the scope of the casual user making an average picture for upload.

As Big as it Needs to Be
Just remember that your images, and your image files, should be just as large as they need to be to show your subject and deliver your message, and no more. Beyond that, trim the fat. Cut clutter off the edges of the image. Resize the images to be just a big as it needs to be, and no larger. Consider reducing noise and clutter that add nothing to your picture. Set your compression settings enough to reduce the size of your files without detracting from your delivered image.

Doing these things will save disk space, cut upload times, cut download times, reduce bandwidth charges, and make your web pages load faster. They'll make both you, and the people viewing your images, happier, and what's not to like about that?

Tuesday, July 04, 2006

Cut and Paste

Astro-Dan has been posting a series of figures computer blended into historic photo backgrounds, and over on the Sandbox we've been discussing tips for realistically blending a figure with the background. This is more art than science, and requires supplying the eye with cues that trick it into thinking the overlaid foreground is part of the photo background. You could write a book about it, but here are a few tips from this non-expert:

1: Match the shadows and light sources. The eye and brain are really good in picking up these cues, especially in photos, where this is how we judge the depth and size of the objects in the 2D picture. At the very least, try to match the primary light source.

Look at your figure. Where are the shadows on the face? If they're on the left, the light source is on the right. If they're on the right, the light source is on the left. If they're under the brows, nose, and chin, then the light is coming from above. This should match your background photo as close as possible. If there are no distinct shadows, or the shadows aren't pronounced, then the light on the figure is diffuse. If there are strong shadows in your background, it won't match.

One trick that sometimes works: if your figure has the light source on one side, and the background has the light on the other, its sometimes possible to flip one or the other (mirror image) and make it match. Obviously this doesn't work if there's something in the image to establish the "handedness" of the image. Any flipped writing will be backwards. Car steering wheels will be on the wrong side (but hey, we could be in England!). And Joe's scar could be on the wrong cheek!

2: Match the contrast of the background. Nothing will give away a "paste job" faster than a high-contrast figure against a washed-out background shot. Your photo editing software will probably have a brightness and contrast tool. It may have other brightness tools that are even more powerful (though they can be more difficult to figure out and use).

3: Match the color tone. Figure photos taken inside under incandescent lights are often "warm" in color tone. Fluorescent light sometimes results in a greenish tone. Photos taken outside under sunlight usually have a bluish tone. Your photo editing software probably has tools to fix this.

4. Match the color saturation. Modern photos taken under artificial light often have bright, over-saturated, colors. Historic photos taken outside often have muted, washed-out colors. Foreground should match background.

5. Match size and perspective. It's pretty basic that things that are closer are bigger, and that things which are farther away look smaller. In a photo scene, things contract towards an imaginary "vanishing point," which (on a flat plain, anyway) will lie along the horizon.

I could go into a big, not very informed lecture about perspective here. Trust it to say that your eyes and brain judge the size and distance of an object in a picture by its position in the picture in relation to other objects.


Take a look at this example I whipped up. The lines on the football field converge on our "vanishing point," illustrated with the red lines converging on the (hidden) horizon). On the left, I've arranged four figures positioned to appear the same height, even though each is about 20% smaller than the next. Note that as they stand on a line towards the vanishing point, another such line connects the tops of all their heads. Yes, I know that they look about 12-feet tall, but they ALL look 12-feet tall. That's what's important.

Now look at the figures standing along a similar line on the right. Believe it or not, these are the SAME four figures. I've just reversed the order. The monster standing back-rightis EXACTLY the same size as the more normal-looking guy standing front-left. The tiny shrimp front right is EXACTLY the same size as the fellow back left.

Likewise, any figure you paste into a photo background has to relate properly to the objects around them, or they're going to appear to be a giant, or a shrimp, or just hanging in the air in front of a distant scene, or worst of all, just pasted on a flat background like a stamp on an envelope.

Experiment with size and position relative to the background, and trust your eye on this. One trick I find useful is to look at the figure's feet. Though the imaginary plain leading off to the horizon may be flat, to your eye it SEEMS steeper as it's closer to the observer, and flatter towards the horizon. If you're looking down at the tops of a figure's feet, then it probably belongs close to the front of your image. If that makes him look gigantic, then he needs to be made slower. If, on the other hand, you seem to be looking at the sides of the shoes straight-on, then he belongs off in the distance, and should be positioned and resized accordingly. Use people, doorways, and other such details as reference in positioning your foreground picture.

Notice how the giant on the right rear seems to be up on his toes, about to topple forward, or to launch himself into the sky. That's a foot position cue at work. He needs to be closer to the bottom front of the picture.


Okay, this is a quick example of putting these rules into practice, hijacking one of Dan's own images, his 1912 lunar astronaut. I've dug a NASA lunar photo out of my files and added him in.

This first example is done wrong. First of all, the position of the figure is wrong. He's too close to the front, and seems to be tipping backwards on his heels. One would expect light on the moon to be bluish and colors somewhat subdued. Instead, the figure is very saturated, and the colors warm. At best, he looks like he's standing in front of a photo backdrop. At worst, it's the stamp and envelope effect.

Now this next one isn't perfect, but it's not bad. I've cooled off the colors in the figure, increased the contrast, and reduced the color saturation, to make him fit with the background better. A couple of additional tricks. I added some blotchy shadows under his feet and to the right of him and the flag. These don't exactly match either the sharp shadows on his suit, of the washed-own and almost shadow-free background, but they do help to "ground" him in the scene. One other little trick, I copied a rock from the background (and reshaped it a bit, but that isn't necessary) and put in in FRONT of the toe of one of his boots. Again, that helps to "stick" him to the scene.

Again, though the figure in the "bad" image seems bigger, it's exactly the same size relative to the background as the "good" image.

This post really just scratches the surface, but hopefully it will provide some useful tips to apply in creating your own photos.

Wednesday, February 22, 2006

Angry Joe Day entries: MaxMike



A couple of cool entries from MaxMike up Washington way. Says Mike, "Here's my entry. Angry enough for ya?" Not sure how these speak to the theme, but angry they are! Angry Joe as fine-art.

UPDATE: Incoming mail from Mike. He forgot his caption (thus addressing the theme thing) -

"Knew there was something I forgot:

'Think 12 INCH IS DEAD, EH? TAKE THAT HASBRO!!!!'"

Wednesday, December 14, 2005

Breaking out the luggage



A few more space photos from the archive. This is a cart/trailer that I made inspired by the "Modular Equipment Transporter," a two-wheeled equipment cart used on Apollo 14. It's made from some toy vehicle wheels, some drawer organizers, the handle from a craft-store shovel, and some assorted hardware.

It's appropriate to feature this "space luggage," as I'm leaving tomorrow on a trip to Southern California to visit my son. I'll be gone about a week, and it remains to be seen what (if anything) I'll post while I'm gone.

If I don't post, I'll be home before Christmas, with plenty of time to post a retrospective of some of my favorite 1/6th holiday shots.

See you then.

- Steve

Wednesday, November 30, 2005

Big Bird

I mean, what else would you call a big yellow C-130 Hercules? This is one of my more unusual photo edits, in that there aren't any 1/6th items in it at all.

I started wondering, how does the Adventure Team deploy all those vehicles and fuzzy-headed guys all over the world? Obviously they'd have a transport aircraft of some sort, but what would it look like? This is my attempt to answer those quesitons.

No idea where I got the base shots. I'm not even sure if it's a real plane or a model. I was relatively new at doing sophisticated photo editing when I did this, and I could doubtless do better now. The green shadows and the too-dark tail don't look quite right. (Must be flying through the shadow of a cloud. Yeah, that's the ticket.) Still, fairly cool.

But then you start to wonder, what's in the plane? I had to look around quite a bit to find this base shot of vehicles being air-dropped, and then I used an existing shot of my custom MLV (Mobile Logistics Vehicle). I think it's a little undersized, but as I recall, I had to do it this way to make the perspective work.



Finally, my favorite of this bunch of photo edited shots. It really looks like I took my custom LMUTT mini-truck and plopped it down on the ground behind a Chinook helicopter. It's difficult to tell where the grass in the base shot stops, and the grass in my front yard starts. Stretched out, this makes a pretty cool desktop.

Hmm, I suppose I could have tried to make the Chinook yellow, but that's taking "flying banana" way too literally.

So, now you know more than you wanted to about AT air-deployment. "The Adventure Team is needed..."

...well, somewhere far away.

Tuesday, November 29, 2005

Hang in there


It's about midnight here, and time to post another picture. Here's one more from the archives, a favorite photo edit.

The figure in the foreground is an Adventure Team dinosaur hunter I kitbashed a while back named Scotty Travis.

The location here is actually a roadside along Highway 101 just north of Newport, Oregon. The "cliff" here actually isn't rock, it's just packed, sandy, soil, cut away by road workers. The distant cliff behind the helicopter is actually only a few feet from the figure, but it gives a pretty good illusion of distance. The 21st Century Toys rescue helicopter was actually shot in my office, and added to the scene later using Paint Shop Pro.

By the way, with any of the pictures here, the small shot in the message is only a thumbnail. Just click on the picture to see it full-sized.