image-js / test

Provides test images for use in other packages
MIT License
2 stars 0 forks source link

How to check the format of an image ? #5

Open lpatiny opened 9 years ago

lpatiny commented 9 years ago

You can use on unix system the "file" command. It seems installed by default on mac and linux ?!

> file grey8.png 
grey8.png: PNG image data, 30 x 90, 8-bit grayscale, non-interlaced

And it show that all the pictures in the 'format' folder are really the expected one.

lpatiny commented 9 years ago

identifyalso provides information and seems to be a standard unix command:

> identify grey16.png
grey16.png PNG 30x90 30x90+0+0 16-bit sRGB 258B 0.000u 0:00.000

If you want the full information you may also use the 'verbose' flag

> identify -verbose grey16.png
Image: grey16.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 30x90+0+0
  Resolution: 28.35x28.35
  Print size: 1.0582x3.1746
  Units: PixelsPerCentimeter
  Type: Grayscale
  Base type: Grayscale
  Endianess: Undefined
  Colorspace: Gray
  Depth: 16/15-bit
  Channel depth:
    gray: 15-bit
  Channel statistics:
    Pixels: 2700
    Gray:
      min: 0 (0)
      max: 65535 (1)
      mean: 53078.7 (0.80993)
      standard deviation: 16992.3 (0.259286)
      kurtosis: 1.57013
      skewness: -1.48351
      entropy: 0.84523
...