-
Notifications
You must be signed in to change notification settings - Fork 11
/
images.tex
49 lines (49 loc) · 1.56 KB
/
images.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
%!TEX root = cv-sheet.tex
\section{Images}
\begin{itemize}
\item color depth = bit depth = bits per pixel = bbp
\item dithering: putting 2 colors close to give illusion of a 3rd color.
\item grayscale img: $8$ bpp, black = 0 \& white = 255.
\item color: $24$ bpp, $8$ bits for each channel of RGB, \& possible alpha channel. $\alpha = 0 \implies$ fully transp., $\alpha = 1 \implies$ fully opaque.
\end{itemize}
\subsection{BMP Format}
\begin{tabular}{|c|}
\hline
file header\\
(size, offset, \dots)\\
\hline
info header (DIB)\\
(width, height, \dots)\\
\hline
optional color palette\\
\hline
image data\\
\hline
\end{tabular}
\subsubsection{File Header}
$14$ bytes
\begin{itemize}
\item magic identifier: $2$ bytes
\item file size : $4$ bytes
\item $2$ reserved places: $2$ bytes each
\item offset to image data: $4$ bytes
\end{itemize}
\subsubsection{Info Header}
$40$ bytes
\begin{itemize}
\item header size in bytes: $4$ bytes
\item width and height : $4$ bytes each
\item number of color planes: $2$ bytes
\item number of bits per pixel: $2$ bytes
\item compression (0 to 3): $4$ bytes, $0 = none$
\item image size in bytes: $4$ bytes
\end{itemize}
{\color{red} Note that the order is $B \rightarrow G \rightarrow R$, \& all bytes are written in reverse order.}
\subsubsection{Color Palette}
\begin{itemize}
\item If present, then a pixel is stored in $\leq 1$ bytes.
\item Each color entry is in $RGBA$ format with $4$ bytes.
\item If not present, $offset = 14+40 =54$, else $offset=54+4*nColors$.
\end{itemize}
%end of section
\hrule