webp-sh / webp_server_go

Go version of WebP Server. A tool that will serve your JPG/PNG/BMP/SVGs as WebP/AVIF format with compression, on-the-fly.
https://docs.webp.sh
GNU General Public License v3.0
1.83k stars 175 forks source link

Could webp_server_go convert unnormal jpeg files? #211

Closed bhzhu203 closed 1 year ago

bhzhu203 commented 1 year ago

related to https://github.com/webp-sh/webp_server_go/issues/208

aliyun CDN webp service can convert the corrupted jpg image to webp correctly.

http://cdn3.selleroa.com/yfni/test/1684547034231096980.jpg

identify -verbose 1684547034231096980.jpg
Image:
  Filename: 1684547034231096980.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Mime type: image/jpeg
  Class: DirectClass
  Geometry: 397x511+0+0
  Resolution: 72x72
  Print size: 5.51389x7.09722
  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: 202867
    Red:
      min: 0  (0)
      max: 255 (1)
      mean: 81.1102 (0.318079)
      median: 81 (0.317647)
      standard deviation: 55.8142 (0.218879)
      kurtosis: -0.181714
      skewness: 0.603061
      entropy: 0.947852
    Green:
      min: 0  (0)
      max: 255 (1)
      mean: 98.9581 (0.388071)
      median: 130 (0.509804)
      standard deviation: 62.4133 (0.244758)
      kurtosis: -0.979109
      skewness: 0.0567213
      entropy: 0.9666
    Blue:
      min: 0  (0)
      max: 255 (1)
      mean: 52.4654 (0.205747)
      median: 19 (0.0745098)
      standard deviation: 59.1121 (0.231812)
      kurtosis: 1.74558
      skewness: 1.6434
      entropy: 0.875
  Image statistics:
    Overall:
      min: 0  (0)
      max: 255 (1)
      mean: 77.5112 (0.303966)
      median: 76.6667 (0.300654)
      standard deviation: 59.1132 (0.231817)
      kurtosis: -0.563224
      skewness: 0.656722
      entropy: 0.929817
  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)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 397x511+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 94
  Orientation: TopLeft
  Profiles:
    Profile-exif: 1181 bytes
  Properties:
    date:create: 2023-05-20T06:24:35+00:00
    date:modify: 2023-05-20T06:24:35+00:00
    exif:ApertureValue: 169/100
    exif:BrightnessValue: 972/100
    exif:ColorSpace: 1
    exif:Compression: 6
    exif:DateTime: 2023:05:14 11:49:17
    exif:DateTimeDigitized: 2023:05:14 11:49:17
    exif:DateTimeOriginal: 2023:05:14 11:49:17
    exif:DigitalZoomRatio: 10000/10000
    exif:ExifOffset: 273
    exif:ExifVersion: 0220
    exif:ExposureBiasValue: 0/100
    exif:ExposureMode: 0
    exif:ExposureProgram: 2
    exif:ExposureTime: 3/10000
    exif:Flash: 0
    exif:FNumber: 18000/10000
    exif:FocalLength: 540/100
    exif:FocalLengthIn35mmFilm: 26
    exif:GPSAltitude: 530/1
    exif:GPSAltitudeRef: 0
    exif:GPSInfo: 782
    exif:GPSLatitude: 49/1, 20/1, 4828199/1000000
    exif:GPSLatitudeRef: N
    exif:GPSLongitude: 12/1, 26/1, 30176519/1000000
    exif:GPSLongitudeRef: E
    exif:ImageLength: 2992
    exif:ImageUniqueID: B12XSOA01PM
    exif:ImageWidth: 2992
    exif:JPEGInterchangeFormat: 984
    exif:JPEGInterchangeFormatLength: 57628
    exif:LightSource: 0
    exif:Make: samsung
    exif:MaxApertureValue: 169/100
    exif:MeteringMode: 2
    exif:Model: SM-G990B
    exif:OffsetTime: +02:00
    exif:OffsetTimeOriginal: +02:00
    exif:PhotographicSensitivity: 40
    exif:PixelXDimension: 2992
    exif:PixelYDimension: 2992
    exif:SceneCaptureType: 0
    exif:ShutterSpeedValue: 1/3282
    exif:Software: G990BXXU4EWC7
    exif:SubSecTime: 087
    exif:SubSecTimeDigitized: 087
    exif:SubSecTimeOriginal: 087
    exif:WhiteBalance: 0
    exif:YCbCrPositioning: 1
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: a6979b27f47501f08af40fe74c817a3ad8aadb262ba0187902fb42579dc2dad0
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 79134B
  Number pixels: 202867
  Pixels per second: 31.4134MP
  User time: 0.000u
  Elapsed time: 0:01.006
  Version: ImageMagick 7.1.0-13 Q16-HDRI x86_64 2021-10-25 https://imagemagick.org
identify: Invalid SOS parameters for sequential JPEG `1684547034231096980.jpg' @ warning/jpeg.c/JPEGWarningHandler/402.

In ImageMagick , it just is a warinning not error.

n0vad3v commented 1 year ago

https://github.com/webp-sh/webp_server_go/pull/212 might be a fix for this, tried on http://cdn3.selleroa.com/yfni/test/1684547034231096980.jpg and it's working normally, please have a try. Screenshot from 2023-05-22 20-57-17

bhzhu203 commented 1 year ago

Issue solved.

n0vad3v commented 1 year ago

Nice, I'm going to close this issue and release version 0.8.2 for this.