How to check if an image has 2 bytes per pixel and how to convert it to an image with 1 byte per pixel?

Mona Jalal

I have thermal images from FLIR camera that has 2 bytes per pixel. I am not sure how I could check in Ubuntu if these images have 2 bytes per pixel or not.

Also, how can I convert a 2 byte per pixel image to a 1 byte per pixel image?

$ exiv2 frame0171.tiff
File name       : frame0171.tiff
File size       : 4194510 Bytes
MIME type       : image/tiff
Image size      : 1024 x 1024
Camera make     : 
Camera model    : 
Image timestamp : 
Image number    : 
Exposure time   : 
Aperture        : 
Exposure bias   : 
Flash           : 
Flash bias      : 
Focal length    : 
Subject distance: 
ISO speed       : 
Exposure mode   : 
Metering mode   : 
Macro mode      : 
Image quality   : 
Exif Resolution : 1024 x 1024
White balance   : 
Thumbnail       : None
Copyright       : 
Exif comment    : 


$ file frame0171.tiff
frame0171.tiff: TIFF image data, little-endian, direntries=14, height=1024, bps=182, compression=none, PhotometricIntepretation=RGB, width=1024


$ exiv2 Rec-000026_16bit_counts.tif
File name       : Rec-000026_16bit_counts.tif
File size       : 2097433 Bytes
MIME type       : 
Image size      : 0 x 0
Rec-000026_16bit_counts.tif: No Exif data found in the file

$ file Rec-000026_16bit_counts.tif
Rec-000026_16bit_counts.tif: Big TIFF image data, little-endian


$ exiv2 Rec-000026_tiff.tif
File name       : Rec-000026_tiff.tif
File size       : 1816013 Bytes
MIME type       : image/tiff
Image size      : 778 x 778
Camera make     : 
Camera model    : 
Image timestamp : 
Image number    : 
Exposure time   : 
Aperture        : 
Exposure bias   : 
Flash           : 
Flash bias      : 
Focal length    : 
Subject distance: 
ISO speed       : 
Exposure mode   : 
Metering mode   : 
Macro mode      : 
Image quality   : 
Exif Resolution : 778 x 778
White balance   : 
Thumbnail       : None
Copyright       : 
Exif comment    : 

$ file Rec-000026_tiff.tif
Rec-000026_tiff.tif: TIFF image data, little-endian
turbulence

An image typically contains a small amount of header data and large amount of image data. In most cases the percent of data in header is negligibly small so we can neglect it and do a simple calculation and see that it contains 4 bytes per pixel. Divide file size by resolution, you will get bytes per pixel. (But it must be verified that the result is close to an integer)

>>> 4194510/(1024*1024)
>>> 4.0002

Here, 4194510 is the file size in bytes, and 1024*1024 is the resolution.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Convert MONO-16bit image with 2bytes per pixel to MONO-16bit with 1 byte per pixel in C#

How can I lower the bit per pixel of image with OpenCV

How to convert a Mean Cluster size result that is in [pixel image] to the number of mean points per cluster in spatstat?

How to move an image pixel by pixel?

How to create an image pixel by pixel

bytes per pixel, bytes per line - How to use function nativeSetImageBytes in tessbaseapi.cpp of tess-two?

How to convert a grayscale image into a list of pixel values?

How to render full image slowly pixel by pixel?

How to change the transparency of an image pixel by pixel

How to generate 2 pixel BMP image with Awk?

How to apply filmic tone mapping per pixel

TTF_RenderTextSolid() returns a Surface with 1 byte per pixel?

How to stop the image at a specific pixel?

How to find pixel color in image?

How to convert image to [1,0,0,1,0] pixel array with Python?

4 bit per pixel image from binary file in Python with Numpy and CV2?

How to convert image pixel into s-curve shape in canvas

How to convert from pixel unit to square inches of an image in android studio?

How can I convert an array of pixel colors into an image efficiently with Python?

Is there a way to convert an image to black and white pixel by pixel?

How to efficiently find and remove 1 pixel bands of image intensity changes?

How to display only 1 pixel from loaded image and tile it

How do I normalize the pixel value of an image to 0~1?

Python: how to display an image pixel by pixel using random coordinates

how can i draw an image pixel by pixel to jframe

How to efficiently loop over an image pixel by pixel in python OpenCV?

How can I show an image plotting pixel by pixel using python?

How to properly memoize Marshal.ReadByte on a 1 bit per pixel bitmap

How to register an exact X/Y boundary crossing when object is moving more than 1 pixel per update?