jpg bits per pixel
How many bits per pixel in a jpeg. I have a jpg whic开发者_开发技巧h is 425 x 282 and its size is 20635 bytes. If i encode it to a png its 116255 bytes.
General answer:
Bits per pixel = Bits/Pixel, 1 Byte = 8 Bits
=> JPG (20635 * 8 bits) / (425 * 282 pixels) => 1,38 bits per pixel
=> PNG (116255 * 8 bits) / (425 * 282 pixels) => 7,76 bits per pixel
But note you're comparing apples to oranges here. PNG is a lossless format, while JPG loses quality depending on the compression strength. The bits per pixel value will vary for different images and different quality/compression settings for both formats.
Also, don't mix this with the term "bits per pixel" that is used for the color depth of an image which should be 24 bits per pixel (8 bits for each red, green and blue) in both cases, although PNG supports 8 bits per pixel using a color palette, too (or even 32 bits per pixel using an alpha channel).
If you are talking about colour depth, I'm tempted to answer "24-bit" and "RGB or CMYK", but the spec appears to be as complicate as all specs are:
http://en.wikipedia.org/wiki/JPEG_File_Interchange_Format
This has little to do with file size, though. JPEG uses a lossy compression algorithm while PNG uses lossless algorithms. That means that a JPEG picture will normally require a larger file if encoded as PNG.
精彩评论