In the context of this wiki, graphics refers to pictures, images, figures, illustrations, and other artwork that can be used in an eBook. A specialized form of graphics are the glyphs used in fonts and symbols. See also editing graphics.
 Types of Graphics
There are two types of graphics data, bitmapped and vector. It is possible for an image to be built out of both forms. For example a vector representation could be displayed over the top of a bitmap.
 Bitmapped image
This format is also called raster image from the way is it usually displayed. In its simplest form a bitmap draws a picture by laying down a series of dots. If these dots are small enough and laid closely together in a rectangle the image can be discerned. This is the way a TV and a computer screen displays a picture or video. It is also the way digital camera pictures are stored. It is sometimes referred to as a scanned image since it can be recreated by displaying the image one line at a time using a scan device. Scanning it done using horizontal scan lines beginning at the top. Scans are easy to transmit serially.
These dots can have varying brightness which will product a grayscale image. Multiple dots can be used to product a color image as well. One dot is referred to as a pixel when it is represented on an color electronic screen since it may be represented with more than one dot. For example, on a TV a color pixel is built from 3 different colored dots (Red, Green, Blue). RGB is another term used to describe this bitmapped format utilizing the first letters of the three colors. In digital color a "true color" image will devote a full Byte, 8 bits, to each of the three colors thus a single pixel will have 24 bits of data. High Dynamic Range (HDR) will use more than 8 bits to represent each color.
While RGB is a popular format there are also other formats. For example a format described as YCbCr would describe the data information by breaking out the Brightness (monochrome data) Y from the Color component. With this definition a grayscale image could be produced from the Y component alone. The Cb, chroma blue, would contain the data needed to represent the blue and Cr represents the red data. Note that subtracting the B and R data from the Y data would represent the G (Green) data. YCbCr format allows a black and white TV to work with the same data as a color TV.
While a bitmap is typically rectangular in shape, it is possible to make it seem to be an arbitrary shape. Some bitmap formats support a transparent color, that allows you to see through the graphic to the underlying background. This can be used to create odd shaped images and even holes in the image. Some formats can even support a partially transparent color, called an Alpha channel. The number of bits in the Alpha channel determines the level of transparency. An RGB signal with an Alpha channel would be called RGBA.
Of course bitmap images can even represent characters (glyphs) as in Bitmapped fonts.
 Vector image
This format is more like a person would draw. It is lines and shapes drawn like you would do with a pen. However, unlike a free hand drawing these lines and shapes are described mathematically like you or a draftsman might do with graph paper. A line could be described by two xy coordinates on the paper. Attributes could be defined to describe the thickness of the line, the color, etc. Curved lines can also be described mathematically. Closed vector objects can be empty (transparent inside) or filled with a color similar to coloring the image in a coloring book. Objects are typically rendered in a defined order such that later objects are on top of earlier objects which may cause them to obscure a portion of the earlier object. In some cases transparency can be defined to permit the earlier object to show through.
Many standard graphic formats do not support the use of vector formats. TIFF can use a vector format. Vector and Bitmaps images can be combined by drawing the vector data over the top of a bitmap image.
The ePUB standard requires support for SVG, Scaleable Vector Graphics, format. This is a full vector format and is intended to provide searchable text and scaleable images, two things that raster images have trouble with. PDF can handle SVG as well.
The concept of zooming means to reduce (zoom out) or enlarge (zoom in) the object. For text this generally means to change the amount of text on a screen by increasing or decreasing the individual fonts that are used for the text and then reflowing the page. The font change can be done with scaleable fonts or by replacing the font with one of a different size. For images zooming does different things depending on the type of image.
A bitmap image starts at 100% when there is a one to one correspondence between the pixels in the image with the pixels on the screen. Bitmapped graphic images zoom out by removing or merging pixels to achieve the desired size. There can be slight distortion of content unless the zoomed scale is an exact multiple of the source file. Zooming in replicates the pixels which can cause distortion due to uneven replication and will cause blockiness if the zoom in is so much that the duplicated pixels start becoming visible as pixels. Zooming an image beyond the edge of the screen will require panning to see the rest of the image. With some eBook formats the original image is intentionally shrunk for initial display so that the user can zoom in without losing display resolution of the image. Sometimes zooming is accomplished by replacing the image with another image with more or less pixels to avoid the distortion effects. Of course this causes the eBook to be larger to accommodate the separate images. Zooming out can also be accomplished by smoother changes. It this case the image pixels are not just duplicated but instead they are analyzed and replaced with a color or brightness half way between the two original pixels. This, of course, increases the time to display the image.
A vector image typically does not change quality or get distorted as it is zoomed in or out. The image itself is stored as points and objects in a database so it is not stored in a form that looks like an image. Instead the image is created on the screen based on the scaling of coordinates. Zooming just recomputes and recreates the image with a new scale factor. While vector images will scale well there can still be distortion. Sometimes an image is created by connecting point with lines to form an outline of a complex shape. Having too few points can cause distortion when zooming in. Using a Bézier curve can sometimes reduce this distortion.
 Graphic Formats
The Graphics formats listed here are the predominant ones that are used in eBooks. There are many other formats that are not covered because of their limited use in eBooks. Some formats are further described on their own page as indicated by the link.
BMP is the extension used for a BitMaP image file which is an uncompressed graphics format developed by Microsoft. The same format can be compressed and if so the extension is normally changed to RLE. A program that claims to support BMP files may or may not be able to support an RLE file. A generic term that is applied to BMP files is RGB files since the bitmap is made up of red, green, and blue information. Some Generic bitmap files may not list the colors in this order.
A 24 bit uncompressed BMP file is huge and should not be used on any but the smallest of images. Reducing the number of bits may reduce the file size considerably with a sacrifice in the quality of the color image due to the reduced colors if they were in use.
Most OS's other than Windows do not support BMP files and it is not standard for web browsers although accepted by Internet Explorer. TIF files can contain a generic version of BMP data. Device-independent bitmap, DIB, is the term used to describe a generic bitmap. Windows also uses this format for its icons which often have an ICO extension. See also PPM.
GIF stands for Graphics Interchange Format and developed in 1987 by CompuServe. It is a lossless bitmapped graphics format which means the compression technology does not lose any of the image detail. It was designed for the reproduction of line drawings but can work well with photographs. Widely used on the Internet for logotypes and drawings. The coding scheme uses a LZW lossless compression scheme which is patented but patents ran out in 2004.
GIF files use a palletized color scheme which means that the pixel color is selected from a predefined pallet of colors. There can be only a maximum of 256 different colors (8 bits) in the pallet but different pictures can have their own pallet. Some people consider GIF to by a lossy format since there could be losses due to having to reduce the number of colors down to 256. The pallet of colors itself is defined as needed by up to 24 bits of data (12 bits is a popular option). Using less colors and less bits will reduce the file size of the picture. Large areas of one color will also reduce the file size.
It is possible to define one of the colors as a transparency color. When this is done the rendering code will not draw that color on the screen. This allows the background color of the screen to be seen in the image. This is mostly used to make the image shape look like it is the total shape rather than a picture with a frame around it.
Motion GIF - GIF images can be animated but eBook readers typically do not support animation although many web browsers do. If animation isn't supported only the first image in the animation sequence will be shown. Removing the animation frames will make the image size smaller. Animation is done by combining several GIF images in one file. The later images are simply superimposed on the earlier images one by one. The later image can be smaller in size than the original by providing an offset as to where it should be placed. The frame rate is specified in the file itself.
GIF can represent grayscale images of course and can be lossless in this task. Reducing the grayscale gradient can drastically reduce the size of the file. Line art is often best represented as a GIF image.
Gifsicle - A program to manipulates GIF images and animations.
JPG (or JPEG) stands for the Joint Photographic Experts Group. It uses 24 bits to represent a color pixel (often called True Color). It uses a lossy compressed graphics format that is designed to support photographs rather than line art. It was developed in 1992 and issued as the ISO 10918-1 standard in 1994, the quality depends directly on the amount of compression employed. It is widely used on the Internet and by most digital camera manufacturers.
The JPEG File Interchange Format (JFIF) is a minimal version of the JPEG Interchange Format that was deliberately simplified so that it could be widely implemented and thus has become the de-facto standard. Another standard format is the Exchangeable image file format (Exif). This is the specification used for the image files on digital cameras.
There is also a newer format is called JPEG 2000. It generally has a jp2 or jpg2 extension to distinguish the new improved format from the original format however that is not always the case. Older imaging display programs will not display this newer format. PDF files may have images in this format which can make converting them difficult. The latest JPEG format is JPEG XR. It provides even better compression with less processing and can provide lossless compression as well.
PNG stands for Portable Network Graphics format. It is a bitmapped graphic format that employs a lossless compression system. It was designed to improve upon and replace GIF files back when the GIF patent was in effect. PNG does not require a patent license. Its main drawback is the complexity of its color model. It supports many different color schemes including both palettes and direct with differing number of bits. Some software that support PNG may specify that it only supports 8 bit images or have other restrictions on what is supported.
PNG files with more bits per pixel can use some of those bits for transparency. For example a 32 bit pixel might use 24 bits for color (8 for each of the 3 primary colors) and 8 bits for transparency. This is similar to the transparency of GIF images but an existing color is not used. Instead the amount of transparency can be defined per color so that some amount, but perhaps not all, of a background image can show through.
TIF (or TIFF) stands for Tagged Image File Format. It is a container that can hold images in a wide variety of bitmapped or even vector formats. They can also be compressed or uncompressed. If compressed they can use RLE, JPG, LZW, ZIP or potentially other formats. This standard is owned by Adobe. TIF can even support multiple images and even a mix of bitmapped and vector images in the same file.
DjVu is a digital image format with advanced compression technology and high performance value. DjVu supports very high resolution images of scanned documents, digital documents, and photographs. DjVu viewers are available for web browsers, the desktop, and PDA devices. Its main characteristics is that the compress ratio is about 10x better than in PDF format at the same quality. IW44 is a subset simplified version of DJVU.
SVG, scalable vector graphics, is a vector graphic system and is a required feature of the ePUB publishing standard. It is the only vector graphics system with any standardized use in the eBook field. Scalable Vector Graphics (SVG) is a text-based graphics language that describes images with vector shapes, text, and embedded raster graphics.
SWF, Shockwave Flash, currently functions as the dominant format for displaying "animated" vector graphics on the Web. It can also support static vector images of course. Currently this format is only used on eBooks that have LCD screens.
HEIF (High Efficiency Image Format) is a standard image format created by the MPEG group for Video encoding (HEVC) but is suitable for still pictures as well. It is featured in the latest Apple products.
- Netpbm a Unix collection of formats.
- PCX early bitmap format
- DXF exchange format of vector CAD files.
- EXR OpenEXR is a high dynamic-range (HDR) image file format.
- HDR High Dynamic Range Image extends the color/brightness spectrum.
- WebP's lossy image format is based on the intra-frame coding of the VP8 video format.
- FLIF Free Lossless Image Format. Best compression of all lossless formats.
- The IrfanView wiki page contains a fairly exhaustive list of graphics format.
- Native formats defines some internal proprietary formats for graphics.