SamplesPerPixel specifies the number of channels within an image, for example a gray-scale image has 1 channel, whereas a full color (RGB) image typically has three three channels, or four for some formats containing alpha transparency. BitsPerSample specifies the amount of depth within each sample. A gray-scale with 256 levels of gray has SamplesPerPixel=1 and BitsPerSample=8 (2^8 = 256), whereas a monochrome image has SamplesPerPixel=1 and BitsPerSample=1. A full color JPEG has SamplesPerPixel=3 and BitsPerSample=8. Indexed/mapped color formats, such as GIF, will have one channel (SamplesPerPixel=1).
Bits per Pixel = SamplesPerPixel * BitsPerSample.
// Save 256 color mapped bitmap ImageEnView1.IO.Params.BitsPerSample := 8; ImageEnView1.IO.Params.SamplesPerPixel := 1; ImageEnView1.IO.SaveToFile('D:\Alfa.bmp');
// Load a full-color image and save it as 256 color one ImageEnView1.IO.LoadFromFile('D:\Im.jpg'); ImageEnView1.Proc.ConvertTo(ie8p, ieptFixedHalftone256, iedtOrdered8x8); ImageEnView1.IO.Params.BitsPerSample := 8; ImageEnView1.IO.Params.SamplesPerPixel := 1; ImageEnView1.IO.SaveToFile('D:\Image256.bmp');