Missing file - Quantization tables are too coarse for baseline JPEG

One of the images is not added to the library.

Using ./photostructure info f:/SynologyDrive/Photos/0001/0153.jpg (see output on the link above) we could see this file was not ignored but is considered as invalid due to the following warning

validFile: 'invalid file F:\\SynologyDrive\\Photos\\0001\\0153.jpg: Caution: quantization tables are too coarse for baseline JPEG⁶³²'

This file should be added to the library anyway. Optionally, we could be advised how to “repair” the file to get rid of the warning

PhotoStructure’s image validation uses libjpeg, which is the source of that warning:

$ jpegtran -outfile /dev/null ~/Desktop/0153.jpg 
Caution: quantization tables are too coarse for baseline JPEG

You can disable all image validation within PhotoStructure by setting PS_VALIDATE_JPEG_IMAGES=0.

(The images in my older libraries haven’t succumbed to these sorts of bitrot: they tend to be either fine, or completely scrambled).

It might be nicer to have a middle ground here, so if libjpeg only has a “caution” or “warning”, those images would still be imported. If you think that’d be nice, feel free to open a new feature request nevermind, I just implemented it:

# +----------------------------+
# |  validationErrorBlocklist  |
# +----------------------------+
#
# If any of the following patterns match a validation error found in a photo
# or video, the file will be considered corrupt and not be imported into your
# library.
#
# Note the patterns are case-insensitive, will be converted into a regular
# expression, and only need to partially match the error message, so, for
# example, a value of "caution" will ignore any error message that contains
# the string "caution".
#
# PS_VALIDATION_ERROR_BLOCKLIST="[\"corrupt\",\"invalid\",\"error\",\"failed\",\"nothing was written into output file\",\"partial file\",\"Cannot determine format of input stream\"]"


I also found that the timezone offset (that I fixed a while back due to your bug report, thanks!), is not generating a correct “capturedAtLocal” value. I’m fixing this as well.

Thanks again for your assistance! :star: :star: :star: :star: :star:

Before:

    _PhotoStructureVersion: '1.0.0-alpha.0',
    capturedAt: {
      date: ExifDateTime {
        year: 1904,
        month: 1,
        day: 1,
        hour: 12,
        minute: 0,
        second: 0,
        millisecond: 0,
        tzoffsetMinutes: 122.06666666666666,
        rawValue: '1904:01:01 12:00:00',
        zoneName: 'Europe/Kiev'
      },
      localCentiseconds: undefined,
      offset: 122.06666666666666,
      src: 'tags:DateTimeOriginal'
    },

After:

...
      localCentiseconds: 1904010112000000,
...

Offtop: I’m impressed by your usage of the term “centiseconds”. My entire life I’ve seen tons of cases when it’s mistakenly called “milliseconds” while it’s obviously 0…99

1 Like