Weird TIFF Error #116

Closed
opened 2021-08-12 03:23:20 +00:00 by ccaprani · 15 comments

On Ubuntu 21.04. Do sudo apt install img2pdf, then in a folder with a few jpg files, run

img2pdf *.jpg -o out.pdf

yields

ERROR:root:error: not a TIFF file (header b'http://n' not valid)

Install does need root access.

On Ubuntu 21.04. Do `sudo apt install img2pdf`, then in a folder with a few jpg files, run `img2pdf *.jpg -o out.pdf` yields `ERROR:root:error: not a TIFF file (header b'http://n' not valid)` Install does need root access.
Owner

Hi,
can you narrow this down to the one specific file in your folder that triggers this problem? Once you have the file, you can post it here and I can have a look at it and tell you why img2pdf throws this error.
Thanks!

Hi, can you narrow this down to the one specific file in your folder that triggers this problem? Once you have the file, you can post it here and I can have a look at it and tell you why img2pdf throws this error. Thanks!
Author

Hi @josch

Not trying to be awkward, but unfortunately I cannot share the images. I tried cropping the private data out of them with convert but the resulting file does not retain the problem (i.e. img2pdf works fine on it). So that's not much help.

I extracted the file info though, and removed identifying elements, in case that helps. They are from an iPhone 12:

Image:
  Filename: IMG_6605.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Mime type: image/jpeg
  Class: DirectClass
  Geometry: 2016x1512+0+0
  Resolution: 72x72
  Print size: 28x21
  Units: PixelsPerInch
  Colorspace: sRGB
  Type: TrueColor
  Base type: Undefined
  Endianness: Undefined
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 3048192
    Red:
      min: 0  (0)
      max: 229 (0.898039)
      mean: 157.774 (0.618721)
      standard deviation: 32.6066 (0.127869)
      kurtosis: 6.47922
      skewness: -2.44706
      entropy: 0.805349
    Green:
      min: 0  (0)
      max: 224 (0.878431)
      mean: 149.985 (0.588177)
      standard deviation: 32.944 (0.129192)
      kurtosis: 5.99962
      skewness: -2.32244
      entropy: 0.824197
    Blue:
      min: 0  (0)
      max: 221 (0.866667)
      mean: 137.167 (0.53791)
      standard deviation: 32.2562 (0.126495)
      kurtosis: 5.07209
      skewness: -2.08791
      entropy: 0.840261
  Image statistics:
    Overall:
      min: 0  (0)
      max: 229 (0.898039)
      mean: 148.309 (0.581602)
      standard deviation: 32.6023 (0.127852)
      kurtosis: 4.96644
      skewness: -2.07082
      entropy: 0.823269
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 2016x1512+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 95
  Orientation: RightTop
  Profiles:
    Profile-8bim: 40 bytes
    Profile-exif: 2512 bytes
    Profile-iptc: 0 bytes
  Properties:
    date:create: 2021-08-12T03:09:32+00:00
    date:modify: 2021-08-12T03:09:10+00:00
    exif:ApertureValue: 14447/10653
    exif:BrightnessValue: 57543/127090
    exif:ColorSpace: 65535
    exif:ComponentsConfiguration: 1, 2, 3, 0
    exif:ExifOffset: 258
    exif:ExifVersion: 48, 50, 51, 50
    exif:ExposureBiasValue: 0/1
    exif:ExposureMode: 0
    exif:ExposureProgram: 2
    exif:ExposureTime: 1/54
    exif:Flash: 24
    exif:FlashPixVersion: 48, 49, 48, 48
    exif:FNumber: 8/5
    exif:FocalLength: 21/5
    exif:FocalLengthIn35mmFilm: 26
    exif:LensMake: Apple
    exif:LensModel: iPhone 12 Pro back triple camera 4.2mm f/1.6
    exif:LensSpecification: 807365/524263, 6/1, 8/5, 12/5
    exif:Make: Apple
    exif:MakerNote: 65, 112, 112, 108, 101, 32, 105, 79, 83, 0, 0, 1, 77, 77, 0, 40, 0, 1, 0, 9, 0, 0, 0, 1, 0, 0, 0, 12, 0, 2, 0, 7, 0, 0, 2, 46, 0, 0, 1, 244, 0, 3, 0, 7, 0, 0, 0, 104, 0, 0, 4, 34, 0, 4, 0, 9, 0, 0, 0, 1, 0,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0, 9, 0, 0, 0, 1, 0, 0, 0, 128, 0, 55, 0, 9, 0, 0, 0, 1, 0, 0, 0, 4, 0, 56, 0, 9, 0, 0, 0, 1, 0, 0, 0, 22, 0, 57, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 58, 0, 9, 0, 0, 0, 1, 0, 0, 0, 4, 0, 59, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 60, 0, 9, 0, 0, 0, 1, 0, 0, 0, 4, 0, 61, 0, 9, 0, 0, 0, 1, 0, 0, 0, 25, 0, 0, 0, 0, 98, 112, 108, 105, 115, 116, 48, 48, 79, 17, 2, 0, 180, 0, 190, 0, 199, 0, 210, 0, 221, 0, 228, 0, 232, 0, 235, 0, 230, 0, 229, 0, 226, 0, 231, 0, 239, 0, 230, 0, 234, 0, 233, 0, 178, 0, 185, 0, 187, 0, 216, 0, 221, 0, 223, 0, 222, 0, 220, 0, 222, 0, 226, 0, 229, 0, 233, 0, 238, 0, 233, 0, 236, 0, 233, 0, 173, 0, 180, 0, 189, 0, 207, 0, 211, 0, 212, 0, 214, 0, 216, 0, 219, 0, 219, 0, 217, 0, 225, 0, 232, 0, 226, 0, 226, 0, 221, 0, 156, 0, 175, 0, 183, 0, 211, 0, 213, 0, 213, 0, 216, 0, 219, 0, 214, 0, 209, 0, 220, 0, 219, 0, 237, 0, 235, 0, 230, 0, 224, 0, 185, 0, 189, 0, 198, 0, 210, 0, 204, 0, 203, 0, 213, 0, 214, 0, 209, 0, 216, 0, 219, 0, 217, 0, 236, 0, 229, 0, 220, 0, 221, 0, 186, 0, 187, 0, 195, 0, 204, 0, 197, 0, 199, 0, 210, 0, 210, 0, 205, 0, 210, 0, 216, 0, 209, 0, 229, 0, 218, 0, 217, 0, 220, 0, 186, 0, 185, 0, 194, 0, 205, 0, 193, 0, 201, 0, 210, 0, 211, 0, 208, 0, 207, 0, 218, 0, 211, 0, 226, 0, 222, 0, 222, 0, 215, 0, 184, 0, 183, 0, 185, 0, 199, 0, 188, 0, 200, 0, 206, 0, 209, 0, 207, 0, 204, 0, 213, 0, 200, 0, 218, 0, 213, 0, 209, 0, 207, 0, 174, 0, 180, 0, 169, 0, 198, 0, 193, 0, 197, 0, 205, 0, 208, 0, 206, 0, 201, 0, 209, 0, 200, 0, 218, 0, 213, 0, 211, 0, 210, 0, 170, 0, 181, 0, 180, 0, 193, 0, 187, 0, 191, 0, 188, 0, 189, 0, 194, 0, 194, 0, 208, 0, 198, 0, 217, 0, 212, 0, 210, 0, 209, 0, 168, 0, 175, 0, 178, 0, 192, 0, 184, 0, 188, 0, 189, 0, 192, 0, 194, 0, 196, 0, 206, 0, 193, 0, 215, 0, 211, 0, 202, 0, 204, 0, 153, 0, 164, 0, 168, 0, 188, 0, 185, 0, 187, 0, 192, 0, 194, 0, 201, 0, 197, 0, 206, 0, 198, 0, 214, 0, 206, 0, 200, 0, 205, 0, 179, 0, 180, 0, 178, 0, 189, 0, 180, 0, 189, 0, 193, 0, 189, 0, 200, 0, 189, 0, 204, 0, 187, 0, 212, 0, 201, 0, 198, 0, 202, 0, 74, 0, 94, 0, 169, 0, 187, 0, 182, 0, 190, 0, 198, 0, 203, 0, 200, 0, 195, 0, 208, 0, 202, 0, 205, 0, 200, 0, 199, 0, 198, 0, 70, 0, 84, 0, 165, 0, 179, 0, 187, 0, 189, 0, 194, 0, 199, 0, 203, 0, 206, 0, 206, 0, 198, 0, 204, 0, 202, 0, 197, 0, 196, 0, 168, 0, 168, 0, 171, 0, 191, 0, 198, 0, 200, 0, 201, 0, 200, 0, 202, 0, 205, 0, 206, 0, 205, 0, 211, 0, 208, 0, 194, 0, 192, 0, 0, 8, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 12, 98, 112, 108, 105, 115, 116, 48, 48, 212, 1, 2, 3, 4, 5, 6, 7, 8, 85, 102, 108, 97, 103, 115, 85, 118, 97, 108, 117, 101, 89, 116, 105, 109, 101, 115, 99, 97, 108, 101, 85, 101, 112, 111, 99, 104, 16, 1, 19, 0, 1, 40, 191, 98, 208, 181, 192, 18, 59, 154, 202, 0, 16, 0, 8, 17, 23, 29, 39, 45, 4
    exif:MeteringMode: 5
    exif:Model: iPhone 12 Pro
    exif:OffsetTime: +10:00
    exif:OffsetTimeDigitized: +10:00
    exif:OffsetTimeOriginal: +10:00
    exif:PhotographicSensitivity: 500
    exif:PixelXDimension: 4032
    exif:PixelYDimension: 3024
    exif:SceneCaptureType: 0
    exif:SceneType: 1
    exif:SensingMethod: 2
    exif:ShutterSpeedValue: 154852/26911
    exif:Software: 14.6
    exif:SubjectArea: 2002, 1506, 2213, 1327
    exif:SubSecTimeDigitized: 020
    exif:SubSecTimeOriginal: 020
    exif:TileLength: 512
    exif:TileWidth: 512
    exif:WhiteBalance: 0
    exif:YCbCrPositioning: 1
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    unknown: iPhone 12 Pro
  Artifacts:
    filename: IMG_6605.jpg
    verbose: true
  Tainted: False
  Filesize: 1156840B
  Number pixels: 3.04819M
  Pixels per second: 109.144MB
  User time: 0.030u
  Elapsed time: 0:01.027
  Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Hi @josch Not trying to be awkward, but unfortunately I cannot share the images. I tried cropping the private data out of them with `convert` but the resulting file does not retain the problem (i.e. `img2pdf` works fine on it). So that's not much help. I extracted the file info though, and removed identifying elements, in case that helps. They are from an iPhone 12: ``` Image: Filename: IMG_6605.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Mime type: image/jpeg Class: DirectClass Geometry: 2016x1512+0+0 Resolution: 72x72 Print size: 28x21 Units: PixelsPerInch Colorspace: sRGB Type: TrueColor Base type: Undefined Endianness: Undefined Depth: 8-bit Channel depth: red: 8-bit green: 8-bit blue: 8-bit Channel statistics: Pixels: 3048192 Red: min: 0 (0) max: 229 (0.898039) mean: 157.774 (0.618721) standard deviation: 32.6066 (0.127869) kurtosis: 6.47922 skewness: -2.44706 entropy: 0.805349 Green: min: 0 (0) max: 224 (0.878431) mean: 149.985 (0.588177) standard deviation: 32.944 (0.129192) kurtosis: 5.99962 skewness: -2.32244 entropy: 0.824197 Blue: min: 0 (0) max: 221 (0.866667) mean: 137.167 (0.53791) standard deviation: 32.2562 (0.126495) kurtosis: 5.07209 skewness: -2.08791 entropy: 0.840261 Image statistics: Overall: min: 0 (0) max: 229 (0.898039) mean: 148.309 (0.581602) standard deviation: 32.6023 (0.127852) kurtosis: 4.96644 skewness: -2.07082 entropy: 0.823269 Rendering intent: Perceptual Gamma: 0.454545 Chromaticity: red primary: (0.64,0.33) green primary: (0.3,0.6) blue primary: (0.15,0.06) white point: (0.3127,0.329) Background color: white Border color: srgb(223,223,223) Matte color: grey74 Transparent color: black Interlace: None Intensity: Undefined Compose: Over Page geometry: 2016x1512+0+0 Dispose: Undefined Iterations: 0 Compression: JPEG Quality: 95 Orientation: RightTop Profiles: Profile-8bim: 40 bytes Profile-exif: 2512 bytes Profile-iptc: 0 bytes Properties: date:create: 2021-08-12T03:09:32+00:00 date:modify: 2021-08-12T03:09:10+00:00 exif:ApertureValue: 14447/10653 exif:BrightnessValue: 57543/127090 exif:ColorSpace: 65535 exif:ComponentsConfiguration: 1, 2, 3, 0 exif:ExifOffset: 258 exif:ExifVersion: 48, 50, 51, 50 exif:ExposureBiasValue: 0/1 exif:ExposureMode: 0 exif:ExposureProgram: 2 exif:ExposureTime: 1/54 exif:Flash: 24 exif:FlashPixVersion: 48, 49, 48, 48 exif:FNumber: 8/5 exif:FocalLength: 21/5 exif:FocalLengthIn35mmFilm: 26 exif:LensMake: Apple exif:LensModel: iPhone 12 Pro back triple camera 4.2mm f/1.6 exif:LensSpecification: 807365/524263, 6/1, 8/5, 12/5 exif:Make: Apple exif:MakerNote: 65, 112, 112, 108, 101, 32, 105, 79, 83, 0, 0, 1, 77, 77, 0, 40, 0, 1, 0, 9, 0, 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, 58, 0, 51, 0, 9, 0, 0, 0, 1, 0, 0, 48, 0, 0, 52, 0, 9, 0, 0, 0, 1, 0, 0, 0, 5, 0, 53, 0, 9, 0, 0, 0, 1, 0, 0, 0, 4, 0, 54, 0, 9, 0, 0, 0, 1, 0, 0, 0, 128, 0, 55, 0, 9, 0, 0, 0, 1, 0, 0, 0, 4, 0, 56, 0, 9, 0, 0, 0, 1, 0, 0, 0, 22, 0, 57, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 58, 0, 9, 0, 0, 0, 1, 0, 0, 0, 4, 0, 59, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 60, 0, 9, 0, 0, 0, 1, 0, 0, 0, 4, 0, 61, 0, 9, 0, 0, 0, 1, 0, 0, 0, 25, 0, 0, 0, 0, 98, 112, 108, 105, 115, 116, 48, 48, 79, 17, 2, 0, 180, 0, 190, 0, 199, 0, 210, 0, 221, 0, 228, 0, 232, 0, 235, 0, 230, 0, 229, 0, 226, 0, 231, 0, 239, 0, 230, 0, 234, 0, 233, 0, 178, 0, 185, 0, 187, 0, 216, 0, 221, 0, 223, 0, 222, 0, 220, 0, 222, 0, 226, 0, 229, 0, 233, 0, 238, 0, 233, 0, 236, 0, 233, 0, 173, 0, 180, 0, 189, 0, 207, 0, 211, 0, 212, 0, 214, 0, 216, 0, 219, 0, 219, 0, 217, 0, 225, 0, 232, 0, 226, 0, 226, 0, 221, 0, 156, 0, 175, 0, 183, 0, 211, 0, 213, 0, 213, 0, 216, 0, 219, 0, 214, 0, 209, 0, 220, 0, 219, 0, 237, 0, 235, 0, 230, 0, 224, 0, 185, 0, 189, 0, 198, 0, 210, 0, 204, 0, 203, 0, 213, 0, 214, 0, 209, 0, 216, 0, 219, 0, 217, 0, 236, 0, 229, 0, 220, 0, 221, 0, 186, 0, 187, 0, 195, 0, 204, 0, 197, 0, 199, 0, 210, 0, 210, 0, 205, 0, 210, 0, 216, 0, 209, 0, 229, 0, 218, 0, 217, 0, 220, 0, 186, 0, 185, 0, 194, 0, 205, 0, 193, 0, 201, 0, 210, 0, 211, 0, 208, 0, 207, 0, 218, 0, 211, 0, 226, 0, 222, 0, 222, 0, 215, 0, 184, 0, 183, 0, 185, 0, 199, 0, 188, 0, 200, 0, 206, 0, 209, 0, 207, 0, 204, 0, 213, 0, 200, 0, 218, 0, 213, 0, 209, 0, 207, 0, 174, 0, 180, 0, 169, 0, 198, 0, 193, 0, 197, 0, 205, 0, 208, 0, 206, 0, 201, 0, 209, 0, 200, 0, 218, 0, 213, 0, 211, 0, 210, 0, 170, 0, 181, 0, 180, 0, 193, 0, 187, 0, 191, 0, 188, 0, 189, 0, 194, 0, 194, 0, 208, 0, 198, 0, 217, 0, 212, 0, 210, 0, 209, 0, 168, 0, 175, 0, 178, 0, 192, 0, 184, 0, 188, 0, 189, 0, 192, 0, 194, 0, 196, 0, 206, 0, 193, 0, 215, 0, 211, 0, 202, 0, 204, 0, 153, 0, 164, 0, 168, 0, 188, 0, 185, 0, 187, 0, 192, 0, 194, 0, 201, 0, 197, 0, 206, 0, 198, 0, 214, 0, 206, 0, 200, 0, 205, 0, 179, 0, 180, 0, 178, 0, 189, 0, 180, 0, 189, 0, 193, 0, 189, 0, 200, 0, 189, 0, 204, 0, 187, 0, 212, 0, 201, 0, 198, 0, 202, 0, 74, 0, 94, 0, 169, 0, 187, 0, 182, 0, 190, 0, 198, 0, 203, 0, 200, 0, 195, 0, 208, 0, 202, 0, 205, 0, 200, 0, 199, 0, 198, 0, 70, 0, 84, 0, 165, 0, 179, 0, 187, 0, 189, 0, 194, 0, 199, 0, 203, 0, 206, 0, 206, 0, 198, 0, 204, 0, 202, 0, 197, 0, 196, 0, 168, 0, 168, 0, 171, 0, 191, 0, 198, 0, 200, 0, 201, 0, 200, 0, 202, 0, 205, 0, 206, 0, 205, 0, 211, 0, 208, 0, 194, 0, 192, 0, 0, 8, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 12, 98, 112, 108, 105, 115, 116, 48, 48, 212, 1, 2, 3, 4, 5, 6, 7, 8, 85, 102, 108, 97, 103, 115, 85, 118, 97, 108, 117, 101, 89, 116, 105, 109, 101, 115, 99, 97, 108, 101, 85, 101, 112, 111, 99, 104, 16, 1, 19, 0, 1, 40, 191, 98, 208, 181, 192, 18, 59, 154, 202, 0, 16, 0, 8, 17, 23, 29, 39, 45, 4 exif:MeteringMode: 5 exif:Model: iPhone 12 Pro exif:OffsetTime: +10:00 exif:OffsetTimeDigitized: +10:00 exif:OffsetTimeOriginal: +10:00 exif:PhotographicSensitivity: 500 exif:PixelXDimension: 4032 exif:PixelYDimension: 3024 exif:SceneCaptureType: 0 exif:SceneType: 1 exif:SensingMethod: 2 exif:ShutterSpeedValue: 154852/26911 exif:Software: 14.6 exif:SubjectArea: 2002, 1506, 2213, 1327 exif:SubSecTimeDigitized: 020 exif:SubSecTimeOriginal: 020 exif:TileLength: 512 exif:TileWidth: 512 exif:WhiteBalance: 0 exif:YCbCrPositioning: 1 jpeg:colorspace: 2 jpeg:sampling-factor: 2x2,1x1,1x1 unknown: iPhone 12 Pro Artifacts: filename: IMG_6605.jpg verbose: true Tainted: False Filesize: 1156840B Number pixels: 3.04819M Pixels per second: 109.144MB User time: 0.030u Elapsed time: 0:01.027 Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org ```
Owner

It is of course completely understandable if you cannot share a private photo.

Unfortunately, there is also nothing I can do without a file that shows the problem you are facing.

Maybe you can use your phone to take a new photo without anything private in it that triggers the issue you saw?

It is of course completely understandable if you cannot share a private photo. Unfortunately, there is also nothing I can do without a file that shows the problem you are facing. Maybe you can use your phone to take a new photo without anything private in it that triggers the issue you saw?
Author

@josch it's not my phone - it's a scan of a document sent to me to process. If I come across it again and can share, I certainly will. In the meantime, maybe someone here who has an iPhone 12 could see if they have the problem with its output?

@josch it's not my phone - it's a scan of a document sent to me to process. If I come across it again and can share, I certainly will. In the meantime, maybe someone here who has an iPhone 12 could see if they have the problem with its output?
Owner

If it's a scan, then it should not be related to your phone, no?

You could ask the person from whom you got the scan to scan an empty page for you.

Maybe you can also find out which scanner they were using.

If it's a scan, then it should not be related to your phone, no? You could ask the person from whom you got the scan to scan an empty page for you. Maybe you can also find out which scanner they were using.
Author

Ah, thanks @josch. That never occurred to me because of the situation! But I asked, and the individual kindly sent on an image that issues the same problem as noted above. Hope it helps!

Ah, thanks @josch. That never occurred to me because of the situation! But I asked, and the individual kindly sent on an image that issues the same problem as noted above. Hope it helps!
Contributor

If it's a scan, then it should not be related to your phone, no?
Maybe you can also find out which scanner they were using.

The way I understood @ccaprani, the document was "scanned" (photographed) with an iPhone 12 and sent to him by another person, right? So it hasn't got anything to do with scanner hardware.

> If it's a scan, then it should not be related to your phone, no? > Maybe you can also find out which scanner they were using. The way I understood @ccaprani, the document was "scanned" (photographed) with an iPhone 12 and sent to him by another person, right? So it hasn't got anything to do with scanner hardware.
Contributor

I just tried to convert the image you uploaded, and with a warning I get an ouptut pdf, but the result is really weird: The first page is correct, but there's an inadvertent second page with the image rotated, much bigger and darker.
This is the warning:

/home/mara/.local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py:811: UserWarning: Image appears to be a malformed MPO file, it will be interpreted as a base JPEG file
  warnings.warn(

(img2pdf 0.4.1, Pillow 8.3.1)

I just tried to convert the image you uploaded, and with a warning I get an ouptut pdf, but the result is really weird: The first page is correct, but there's an inadvertent second page with the image rotated, much bigger and darker. This is the warning: ``` /home/mara/.local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py:811: UserWarning: Image appears to be a malformed MPO file, it will be interpreted as a base JPEG file warnings.warn( ``` (img2pdf 0.4.1, Pillow 8.3.1)
Contributor

@ccaprani Can you confirm the behaviour I described above, or do you still get the TIFF error on this file?

@ccaprani Can you confirm the behaviour I described above, or do you still get the TIFF error on this file?
Owner

I'm making the same obseravation on my system as @mara0004. I'm not getting the not a TIFF file error but the MPO warning.

If this file also produces the not a TIFF file error on your system, then you should probably next share the versions of the libraries you have installed.

Thanks!

I'm making the same obseravation on my system as @mara0004. I'm not getting the `not a TIFF file` error but the `MPO` warning. If this file also produces the `not a TIFF file` error on your system, then you should probably next share the versions of the libraries you have installed. Thanks!
Author

HI @josch and @mara0004,

Yes, confirmed this is the terminal response for this file:
ERROR:root:error: not a TIFF file (header b'http://n' not valid)
Running img2pdf 0.4.0 installed via apt as above.

So I installed img2pdf (0.4.1) using pip, and executed:

>>> with open("out.pdf","wb") as f:
...     f.write(img2pdf.convert('image0.jpeg'))

and this works ok on my system (Ubuntu 21.094, with Pillow 8.3.1)

HI @josch and @mara0004, Yes, confirmed this is the terminal response for this file: ```ERROR:root:error: not a TIFF file (header b'http://n' not valid)``` Running `img2pdf 0.4.0` installed via apt as above. So I installed img2pdf (0.4.1) using pip, and executed: ```python >>> with open("out.pdf","wb") as f: ... f.write(img2pdf.convert('image0.jpeg')) ``` and this works ok on my system (Ubuntu 21.094, with Pillow 8.3.1)
Owner

Ah indeed, yes, the image that you posted is a JPEG but it is also an MPO file and support for MPO JPEGs was added in d29c596fe7 which is part of img2pdf 0.4.1. Details can be found in #93.

So yeah, the img2pdf version in Ubuntu 21.04 doesn't support MPO JPEGs and it's not possible to identify the JPEG as an MPO from the identify output you posted, unfortunately.

Maybe you can approach the Ubuntu maintainers to apply d29c596fe7 to the package they ship?

Ah indeed, yes, the image that you posted is a JPEG but it is also an MPO file and support for MPO JPEGs was added in d29c596fe79e4bccd986b0f9e045bab3dbab02dd which is part of img2pdf 0.4.1. Details can be found in #93. So yeah, the img2pdf version in Ubuntu 21.04 doesn't support MPO JPEGs and it's not possible to identify the JPEG as an MPO from the `identify` output you posted, unfortunately. Maybe you can approach the Ubuntu maintainers to apply d29c596fe79e4bccd986b0f9e045bab3dbab02dd to the package they ship?
Author

@josch Thanks for getting to the bottom of this. At least it's a 0.4.0 feature not a bug :p In any case, I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1 for sudo apt install.

@josch Thanks for getting to the bottom of this. At least it's a 0.4.0 feature not a bug :p In any case, I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1 for `sudo apt install`.
Contributor

I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1

You'd probably have to file a package bug report at launchpad.net. However, I think the chances for Ubuntu to update img2pdf are quite low, they usually refuse to update packages unless affected by a security issue.

> I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1 You'd probably have to file a package bug report at launchpad.net. However, I think the chances for Ubuntu to update img2pdf are quite low, they usually refuse to update packages unless affected by a security issue.
Owner

No, I don't have anything to do with Ubuntu packaging except if you count that Ubuntu regularly pulls packages from Debian where I'm the maintainer. So the Ubuntu changelog lists me but I have no way to modify anything in Ubuntu. They just imported the package that I maintain in Debian.

No, I don't have anything to do with Ubuntu packaging except if you count that Ubuntu regularly pulls packages from Debian where I'm the maintainer. So the [Ubuntu changelog](http://changelogs.ubuntu.com/changelogs/pool/universe/i/img2pdf/img2pdf_0.4.0-1/changelog) lists me but I have no way to modify anything in Ubuntu. They just imported the package that I maintain in Debian.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#116
No description provided.