Skip to content

image/jpeg: jpeg.DecodeConfig fails on image with sampling-factor: 2x2,1x1,1x2 #54997

Open
@bozaro

Description

@bozaro

What version of Go are you using (go version)?

$ go version
go version go1.19.1 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bozaro/.cache/go-build"
GOENV="/home/bozaro/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/bozaro/go/pkg/mod"
GONOPROXY=""
GONOSUMDB="github.com/joomcode/*"
GOOS="linux"
GOPATH="/home/bozaro/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.19"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.19/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3402794597=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I try execute jpeg.DecodeConfig for image image.jpeg and got error luma/chroma subsampling ratio at https://github.com/golang/go/blob/go1.19.1/src/image/jpeg/reader.go#L391.

identify -verbose image.jpeg Output
$ identify -verbose image.jpeg
Image:
  Filename: image.jpeg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Mime type: image/jpeg
  Class: DirectClass
  Geometry: 1440x624+0+0
  Units: Undefined
  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: 898560
    Red:
      min: 0  (0)
      max: 255 (1)
      mean: 173.819 (0.681644)
      standard deviation: 87.5221 (0.343224)
      kurtosis: -0.990504
      skewness: -0.80329
      entropy: 0.558242
    Green:
      min: 0  (0)
      max: 255 (1)
      mean: 168.212 (0.659656)
      standard deviation: 88.9555 (0.348845)
      kurtosis: -1.1937
      skewness: -0.683327
      entropy: 0.568201
    Blue:
      min: 0  (0)
      max: 255 (1)
      mean: 186.976 (0.73324)
      standard deviation: 87.2747 (0.342254)
      kurtosis: -0.759731
      skewness: -0.985872
      entropy: 0.561858
  Image statistics:
    Overall:
      min: 0  (0)
      max: 255 (1)
      mean: 176.336 (0.691513)
      standard deviation: 87.9174 (0.344774)
      kurtosis: -1.00832
      skewness: -0.815069
      entropy: 0.562767
  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: 1440x624+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 39
  Orientation: Undefined
  Profiles:
    Profile-icc: 452 bytes
  Properties:
    date:create: 2022-09-10T20:09:08+00:00
    date:modify: 2022-09-10T20:09:08+00:00
    icc:description: sRGB ImageOptim.com
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x2
    signature: ee84ebccc5b0bfcb885a9e654e7cbd033d82d0e8ba4d9d2d1f276f6ce742cfd8
  Artifacts:
    filename: image.jpeg
    verbose: true
  Tainted: False
  Filesize: 57127B
  Number pixels: 898560
  Pixels per second: 169.419MB
  User time: 0.000u
  Elapsed time: 0:01.005
  Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
x

What did you expect to see?

I expects image.Config with actual image size and color model.

What did you see instead?

error: luma/chroma subsampling ratio

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions