Skip to content

UnknownImageFormatException for 'some' jpg files #2973

@China-MYJSY

Description

@China-MYJSY

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

3.1.11

Other ImageSharp packages and versions

none

Environment (Operating system, version and so on)

window11 x64

.NET Framework version

.net9

Description

When trying to load a local .jpg file, the following error occurs:

SixLabors.ImageSharp.UnknownImageFormatException:“Image cannot be loaded. Available decoders:
 - PBM : PbmDecoder
 - PNG : PngDecoder
 - GIF : GifDecoder
 - BMP : BmpDecoder
 - TGA : TgaDecoder
 - JPEG : JpegDecoder
 - TIFF : TiffDecoder
 - Webp : WebpDecoder
 - QOI : QoiDecoder
”

    SixLabors.ImageSharp.Formats.ImageFormatManager.ThrowInvalidDecoder(SixLabors.ImageSharp.Formats.ImageFormatManager)
    SixLabors.ImageSharp.Image.InternalDetectFormat(SixLabors.ImageSharp.Configuration, System.IO.Stream)
    SixLabors.ImageSharp.Image.DiscoverDecoder(SixLabors.ImageSharp.Formats.DecoderOptions, System.IO.Stream)
    SixLabors.ImageSharp.Image.Decode(SixLabors.ImageSharp.Formats.DecoderOptions, System.IO.Stream)
    SixLabors.ImageSharp.Image.Load.AnonymousMethod__0(System.IO.Stream)
    SixLabors.ImageSharp.Image.WithSeekableStream<T>(SixLabors.ImageSharp.Formats.DecoderOptions, System.IO.Stream, System.Func<System.IO.Stream, T>)
    SixLabors.ImageSharp.Image.Load(SixLabors.ImageSharp.Formats.DecoderOptions, System.IO.Stream)
    SixLabors.ImageSharp.Image.Load(SixLabors.ImageSharp.Formats.DecoderOptions, string)
    SixLabors.ImageSharp.Image.Load(string)

Steps to Reproduce

using var image1 = SixLabors.ImageSharp.Image.Load("c90b4985f3b2db100e1f287ded9cfb8c9439513d.jpg");

Images

I put the image inside a ZIP archive.

c90b4985f3b2db100e1f287ded9cfb8c9439513d.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions