What is the difference between all of these picture formats? Why do some take up more memory than others? As far as I can tell a two dimensional picture has two variables: Color and Location. How is it that some of these formats take the same information and use less memory?
The different formats are, generally speaking, split by the type of images and media they were designed for – plain, limited colour graphics, or full-colour photographs.
JPEG (Joint Photographic Experts Group) – created specifically for displaying photographs, with a compression scheme designed for that purpose. 24-bit colour and generally very large in size! Each JPEG requires (automatically-handled) decompression when viewed, unlike GIFs. In short, big, high-colour and slow to load.
GIF (Graphics Interchange Format) – created by Compuserve specifically for electronic image delivery, limited to 256 colours; images converted to GIFs may have some colours replaced with the nearest matches from the palette. Better used for graphics rather than photographs. In short, faster to load thanks to the limited colour range, but not capable of displaying a great range of colours (poor for photographs).
PICT (Apple Macintosh QuickDraw File) – Macintosh image file format used in many page layout and design applications.
TIFF (Tagged Image File Format) – general-purpose high-quality format, but also generally large sized.
BMP (Bitmap Image File) – standard Microsoft Windows format, with little in the way of decompression (and hence usually large).
Umm, Jpeg, large and slow to load?
That sort of depends on the compression level the person saving the file used, doesn’t it?
I’m not absolutely sure, but I also believe that jpeg is the only lossey format of those you’ve listed. None of the others lose information in the process of saving the file. This is one reason that using too much compression when saving a .jpeg (also used as .jpg) graphic will degrade the quality of the image.
Another resource that a quick Google search turned up:
Graphic File Format Overview
Hmm. My (admittedly not world-beating) understanding is that even with compression, JPEG images are generally larger in size (memory-wise, obviously) and slower to load. Apparently the compression doesn’t usually quite compensate for the greater colour range.
Methinks the OP may be looking for an answer on a different level here, rather than a comparison between these formats.
First, I think the discussion to this point has implicitly assumed raster (bitmap) formats. If this is what the OP means by the only two variables being color and location, it’s worth mentioning vector formats as well:
You can present an image as information concerning a collection of dots or pixels of various colors, but you can also represent it as a set of drawing instructions - rather than encoding the image by saying what color each dot is, you say things like “draw a purple line from point (x,y) to point (w,z)” or “draw an arc” or “fill the polygon I just drew with green”. This class of formats is referred to as “vector” formats.
Vector formats have the advantage of being more device independent (no implicit resolution) and more flexible for manipulation of image components than raster formats because the structure is implicitly “built in”. A simple image may also be smaller in a vector format, since the relatively few drawing instructions take less space. However, they tend to be more compute intensive for finally rendering the image, because most eventual output devices are rasters.
PICT format has both vector and raster capabilities (most PICT images you see are bitmaps). All of the others discussed are, IIRC, raster formats. The other general-purpose vector format which the average user is likely to have encountered is Adobe postscript. Most vector formats are used in things like CAD packages that the average user won’t encounter, or for specific drawing applications.
As indicated in the discussion of differences above, once you have settled on using a rasterized representation, there are many, many approaches to encoding the data and reducing the size. For instance, imagine that you encode the data as a simple left-to-right scan of colors, dot-by-dot. You could realize that you may get a lot of adjacent dots which are the same, and have a special code that says “the next n dots are all alike” so you don’t have to repeat them. You could separate the bitmap into layers of primary colors to make large areas of identical dots more likely.
I’m simplifying and hand waving a lot here, and I’m not competent to answer detailed questions about the various formats, and the trade offs made in their representations.
I’m pretty sure that another compression technique used in JPEGs is variable-resolution. In other words, in parts of the picture that have a lot of detail, you’ll have small pixels, but in regions that have very little detail, you’ll have huge pixels. Often, if you look at the edges or background of a JPEG (where it probably doesn’t matter as much), you can see large squares of color.
The size of a JPEG can vary greatly, but a typical one will be about one-fortieth the file size of the bitmap it was made from, without serious loss of detail in the image.
Chronos is right. The compression is variable, and it can be controlled using a good image system. MS Paint doesn’t give you compression options, for example, but Adobe Photoshop and MS Image Composer do.
FTR, a GIF can be a larger file than a JPG due to the way it saves information. It uses a form of compression (whose name is completely eluding me), that basically looks at the number of contiguous pixels that are the same color. In other words, if you have a line that is one pixel tall, ten pixels long and red, the file will say “pixels one through ten are red.” This opposed to other, generally larger, formats that would say, “pixel 1 is red, pixel 2 is red, etc.”
The problem is that in a picture with few large areas of the same color (most photographs, for instance), it won’t be able to save information as succinctly. And the data equivalent of “pixel X through Y” will add to the file size and make it larger than a JPG made from the same source file. (Basically saying “pixel 1 through 1 is black” takes more space than a JPG’s “pixel 1 is black.”)
Or something like that…
first their are 3 variables, position, color and intensity. jpg compression uses an compression scheme that limits the number of colors that is displayed but varies the intensity to ‘fool the eye’. as far as I know jpg doesn’t change pixil size.
or at least that’s how it was explained to me
Similar to KKBattousai I believe a JPEG views an image like this:
Pixel 1 is black. Pixel 2 is almost black, so we’ll make it black. Pixel 3 is not quite as black, let’s leave it as semi-black. Pixel 4 is white. Pixel 5 is white, so lets combine the two pixels into one instruction. Oh, pixel 6 is white too, lets include that in the previous instruction. Etc, etc, etc
Only not near as wordy as that.
I could be wrong, but I think that’s the basic premise.