Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

It can't read the jpg which is compress with CCITT T.6 #1803

Open
AnZeng00 opened this issue Mar 5, 2025 · 0 comments
Open

It can't read the jpg which is compress with CCITT T.6 #1803

AnZeng00 opened this issue Mar 5, 2025 · 0 comments

Comments

@AnZeng00
Copy link

AnZeng00 commented Mar 5, 2025

Magick.NET version

14.5

Environment (Operating system, version and so on)

Windows 11 professional Visual studio 2022 with .net framework 4.7.2

Description

it showed below error message:
ImageMagick.MagickCorruptImageErrorException
HResult=0x80131500
Message=improper image header C:\Users\User\source\repos\ReducePDF\ReducePDF\bin\Debug\output\0000.jpg' @ error/tiff.c/ReadTIFFImage/1325 Source=Magick.NET-Q8-x64 StackTrace: 在 ImageMagick.NativeInstance.CheckException(IntPtr exception, IntPtr result) 在 ImageMagick.MagickImage.NativeMagickImage.ReadFile(IMagickSettings1 settings)
在 ImageMagick.MagickImage.Read(String fileName, IMagickReadSettings`1 readSettings, Boolean ping)
在 ImageMagick.MagickImage..ctor(String fileName)
在 ReducePDF.Program.ReduceJPGSize(String sourcePath, String savePath) 在 C:\Users\User\source\repos\ReducePDF\ReducePDF\Program.cs 中: 第 117 行
在 ReducePDF.Program.Main(String[] args) 在 C:\Users\User\source\repos\ReducePDF\ReducePDF\Program.cs 中: 第 25 行

Steps to Reproduce

JpegWriteDefines defines = new JpegWriteDefines()
{
Extent = fileSize, // 100KB
};
//var image = new MagickImage(FileToByteArray(file));
var image = new MagickImage(file);
image.Settings.SetDefines(defines);
image.Format = MagickFormat.Jpeg;
string savedFileName = Path.GetFileName(file);
image.WriteAsync(Path.Combine(savePath, savedFileName));
image.Dispose();

Images

Image

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant