3

I need to probe a lot of images from a command line to see if they will open.

ffprobe is brilliant for multimedia but can anyone steer me in the direction of a similar process I can use for images and if the universe is answering my prayers for pdfs and documents

thanks a lot

3
  • 3
    You can use ffprobe for images too.
    – llogan
    Commented May 17, 2015 at 22:42
  • LordNeckbeard The files are either corrupted or damaged. Fully aware that ffprobe works on images I am liking for an alternative especially for pdfs
    – jim slimm
    Commented May 19, 2015 at 7:32
  • possibly jhove? You can also ask on this new beta stack exchange site: softwarerecs.stackexchange.com
    – rogerdpack
    Commented May 19, 2015 at 16:25

3 Answers 3

4

The closest thing I can think of for "ffprobe for images" is ImageMagick: http://www.imagemagick.org/script/identify.php

Just like ffprobe, except you use identify. It tells you thinks like size, format, encoding, etc.

0
2

You could possibly use file:

$ file rooster.jpg 
rooster.jpg: JPEG image data, EXIF standard 2.21

$ file -b testsrc.png
PNG image data, 320 x 240, 8-bit/color RGB, non-interlaced

$ file insulated_concrete_forms.pdf 
insulated_concrete_forms.pdf : PDF document, version 1.4
2

There is also mediainfo, which does a good job on detecting media file formats.

Image

$ mediainfo --Output=JSON --Full some.jpg
{
"media": {
"@ref": "/path/to/some.jpg",
"track": [
{
"@type": "General",
"ImageCount": "1",
"FileExtension": "jpg",
"Format": "JPEG",
"FileSize": "816218",
"StreamSize": "0",
"File_Modified_Date": "UTC 2019-01-06 20:25:24",
"File_Modified_Date_Local": "2019-01-06 21:25:24"
},
{
"@type": "Image",
"Format": "JPEG",
"Width": "4050",
"Height": "1350",
"ColorSpace": "YUV",
"ChromaSubsampling": "4:4:4",
"BitDepth": "8",
"Compression_Mode": "Lossy",
"StreamSize": "816218",
"extra": {
"ColorSpace_ICC": "RGB"
}
}
]
}
}

PDF:

$ mediainfo --Output=JSON --Full some.pdf
{
"media": {
"@ref": "/path/to/some.pdf",
"track": [
{
"@type": "General",
"TextCount": "1",
"FileExtension": "pdf",
"Format": "PDF",
"Format_Version": "1.3",
"FileSize": "141415",
"StreamSize": "141415",
"File_Modified_Date": "UTC 2019-01-24 08:50:21",
"File_Modified_Date_Local": "2019-01-24 09:50:21"
},
{
"@type": "Text",
"Format": "PDF"
}
]
}
}

Image File with wrong suffix:

$ mediainfo --Output=JSON --Full i-am-a-jpeg.pdf
{
"media": {
"@ref": "/path/to/i-am-a-jpeg.pdf",
"track": [
{
"@type": "General",
"ImageCount": "1",
"FileExtension": "pdf",
"Format": "JPEG",
"FileSize": "816218",
"StreamSize": "0",
"File_Modified_Date": "UTC 2019-01-06 20:25:24",
"File_Modified_Date_Local": "2019-01-06 21:25:24",
"extra": {
"FileExtension_Invalid": "h3d jpeg jpg jpe jps mpo"
}
},
{
"@type": "Image",
"Format": "JPEG",
"Width": "4050",
"Height": "1350",
"ColorSpace": "YUV",
"ChromaSubsampling": "4:4:4",
"BitDepth": "8",
"Compression_Mode": "Lossy",
"StreamSize": "816218",
"extra": {
"ColorSpace_ICC": "RGB"
}
}
]
}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.