diff --git a/src/ImageSharp/Formats/Jpeg/IJpegDecoderOptions.cs b/src/ImageSharp/Formats/Jpeg/IJpegDecoderOptions.cs
index 880a7f7a3f..ef7b377d2b 100644
--- a/src/ImageSharp/Formats/Jpeg/IJpegDecoderOptions.cs
+++ b/src/ImageSharp/Formats/Jpeg/IJpegDecoderOptions.cs
@@ -1,11 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System;
-using System.Collections.Generic;
-using System.IO;
-using SixLabors.ImageSharp.PixelFormats;
-
namespace SixLabors.ImageSharp.Formats.Jpeg
{
///
@@ -18,4 +13,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
///
bool IgnoreMetadata { get; }
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/IJpegEncoderOptions.cs b/src/ImageSharp/Formats/Jpeg/IJpegEncoderOptions.cs
index a84652cefe..4076b7da82 100644
--- a/src/ImageSharp/Formats/Jpeg/IJpegEncoderOptions.cs
+++ b/src/ImageSharp/Formats/Jpeg/IJpegEncoderOptions.cs
@@ -1,11 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System;
-using System.Collections.Generic;
-using System.IO;
-using SixLabors.ImageSharp.PixelFormats;
-
namespace SixLabors.ImageSharp.Formats.Jpeg
{
///
@@ -31,4 +26,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
/// The subsample ratio of the jpg image.
JpegSubsample? Subsample { get; }
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs b/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs
index d3f95e40c0..1d3be063dd 100644
--- a/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs
+++ b/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs
@@ -1,10 +1,8 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System;
using System.IO;
using SixLabors.ImageSharp.Advanced;
-using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.PixelFormats;
diff --git a/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs b/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs
index 23cef59273..c3bf801ac8 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs
@@ -17,4 +17,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
config.ImageFormatsManager.AddImageFormatDetector(new JpegImageFormatDetector());
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs b/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs
index d888986f39..e25957efcf 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs
@@ -16,12 +16,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
///
public IImageFormat DetectFormat(ReadOnlySpan header)
{
- if (this.IsSupportedFileFormat(header))
- {
- return ImageFormats.Jpeg;
- }
-
- return null;
+ return this.IsSupportedFileFormat(header) ? ImageFormats.Jpeg : null;
}
private bool IsSupportedFileFormat(ReadOnlySpan header)
@@ -35,36 +30,24 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
///
/// The bytes representing the file header.
/// The
- private bool IsJfif(ReadOnlySpan header)
- {
- // TODO: This should be in constants
- bool isJfif =
- header[6] == 0x4A && // J
- header[7] == 0x46 && // F
- header[8] == 0x49 && // I
- header[9] == 0x46 && // F
- header[10] == 0x00;
-
- return isJfif;
- }
+ private bool IsJfif(ReadOnlySpan header) =>
+ header[6] == 0x4A && // J
+ header[7] == 0x46 && // F
+ header[8] == 0x49 && // I
+ header[9] == 0x46 && // F
+ header[10] == 0x00;
///
/// Returns a value indicating whether the given bytes identify EXIF data.
///
/// The bytes representing the file header.
/// The
- private bool IsExif(ReadOnlySpan header)
- {
- // TODO: This should be in constants
- bool isExif =
- header[6] == 0x45 && // E
- header[7] == 0x78 && // X
- header[8] == 0x69 && // I
- header[9] == 0x66 && // F
- header[10] == 0x00;
-
- return isExif;
- }
+ private bool IsExif(ReadOnlySpan header) =>
+ header[6] == 0x45 && // E
+ header[7] == 0x78 && // X
+ header[8] == 0x69 && // I
+ header[9] == 0x66 && // F
+ header[10] == 0x00;
///
/// Returns a value indicating whether the given bytes identify Jpeg data.
@@ -72,14 +55,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
///
/// The bytes representing the file header.
/// The
- private bool IsJpeg(ReadOnlySpan header)
- {
- // TODO: This should be in constants
- bool isJpg =
- header[0] == 0xFF && // 255
- header[1] == 0xD8; // 216
-
- return isJpg;
- }
+ private bool IsJpeg(ReadOnlySpan header) =>
+ header[0] == 0xFF && // 255
+ header[1] == 0xD8; // 216
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs
index e6ee4f16c9..7f50a8529c 100644
--- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs
+++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs
@@ -17,7 +17,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
internal class PdfJsFrameComponent : IDisposable, IJpegComponent
{
private readonly MemoryManager memoryManager;
-#pragma warning disable SA1401 // Fields should be private
public PdfJsFrameComponent(MemoryManager memoryManager, PdfJsFrame frame, byte id, int horizontalFactor, int verticalFactor, byte quantizationTableIndex, int index)
{
diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs
index 0fd6d76b31..3a559bb864 100644
--- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs
+++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs
@@ -21,10 +21,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
public ref PdfJsHuffmanTable this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return ref this.tables[index];
- }
+ get => ref this.tables[index];
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
index ae780ce626..244d97fba0 100644
--- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
@@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats.Jpeg.Common;
using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder;
using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components;
@@ -367,14 +366,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
if (this.ComponentCount == 4)
{
- if (this.adobe.ColorTransform == PdfJsJpegConstants.Markers.Adobe.ColorTransformYcck)
- {
- return JpegColorSpace.Ycck;
- }
- else
- {
- return JpegColorSpace.Cmyk;
- }
+ return this.adobe.ColorTransform == PdfJsJpegConstants.Markers.Adobe.ColorTransformYcck
+ ? JpegColorSpace.Ycck
+ : JpegColorSpace.Cmyk;
}
throw new ImageFormatException($"Unsupported color mode. Max components 4; found {this.ComponentCount}");