Browse Source

Enable jpeg

Former-commit-id: 40d6b11321e75d800299ed93368cc629411692af
Former-commit-id: fe1ce463f33c93ef092b9bb9652128851e4130bf
Former-commit-id: 1420fe512ea88a7b4f02cf5cbc327e6ddc04a2bd
af/merge-core
James South 11 years ago
parent
commit
d35803fcdf
  1. 8
      src/ImageProcessor/Formats/Gif/GifDecoder.cs
  2. 29
      src/ImageProcessor/Formats/Jpg/JpegDecoder.cs
  3. 36
      src/ImageProcessor/Formats/Jpg/JpegEncoder.cs
  4. 2
      src/ImageProcessor/Formats/Jpg/LibJpeg/Classic/Internal/my_upsampler.cs
  5. 82
      src/ImageProcessor/Formats/Jpg/LibJpeg/DecompressorToJpegImage.cs
  6. 217
      src/ImageProcessor/Formats/Jpg/LibJpeg/IDecompressDestination.cs
  7. 274
      src/ImageProcessor/Formats/Jpg/LibJpeg/LoadedImageAttributes.cs
  8. 22
      src/ImageProcessor/Image.cs
  9. 78
      src/ImageProcessor/ImageProcessor.csproj
  10. 1
      src/ImageProcessor/ImageProcessor.csproj.DotSettings
  11. 6
      tests/ImageProcessor.Tests/Formats/EncoderDecoderTests.cs
  12. 3
      tests/ImageProcessor.Tests/TestImages/Formats/Jpg/Backdrop.jpg

8
src/ImageProcessor/Formats/Gif/GifDecoder.cs

@ -22,13 +22,7 @@ namespace ImageProcessor.Formats
/// Gets the size of the header for this image type. /// Gets the size of the header for this image type.
/// </summary> /// </summary>
/// <value>The size of the header.</value> /// <value>The size of the header.</value>
public int HeaderSize public int HeaderSize => 6;
{
get
{
return 6;
}
}
/// <summary> /// <summary>
/// Returns a value indicating whether the <see cref="IImageDecoder"/> supports the specified /// Returns a value indicating whether the <see cref="IImageDecoder"/> supports the specified

29
src/ImageProcessor/Formats/Jpg/JpegDecoder.cs

@ -1,10 +1,12 @@
// =============================================================================== // --------------------------------------------------------------------------------------------------------------------
// JpegDecoder.cs // <copyright file="JpegEncoder.cs" company="James South">
// .NET Image Tools // Copyright © James South and contributors.
// =============================================================================== // Licensed under the Apache License, Version 2.0.
// Copyright (c) .NET Image Tools Development Group. // </copyright>
// All rights reserved. // <summary>
// =============================================================================== // Image decoder for generating an image out of a jpg stream.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor.Formats namespace ImageProcessor.Formats
{ {
@ -13,20 +15,15 @@ namespace ImageProcessor.Formats
using BitMiracle.LibJpeg; using BitMiracle.LibJpeg;
/// <summary> /// <summary>
/// Image decoder for generating an image out of an jpg stream. /// Image decoder for generating an image out of a jpg stream.
/// </summary> /// </summary>
public class JpegDecoder : IImageDecoder public class JpegDecoder : IImageDecoder
{ {
#region IImageDecoder Members
/// <summary> /// <summary>
/// Gets the size of the header for this image type. /// Gets the size of the header for this image type.
/// </summary> /// </summary>
/// <value>The size of the header.</value> /// <value>The size of the header.</value>
public int HeaderSize public int HeaderSize => 11;
{
get { return 11; }
}
/// <summary> /// <summary>
/// Indicates if the image decoder supports the specified /// Indicates if the image decoder supports the specified
@ -145,13 +142,11 @@ namespace ImageProcessor.Formats
pixels[offset + 0] = (byte)sample[2]; pixels[offset + 0] = (byte)sample[2];
pixels[offset + 1] = (byte)sample[1]; pixels[offset + 1] = (byte)sample[1];
pixels[offset + 2] = (byte)sample[0]; pixels[offset + 2] = (byte)sample[0];
pixels[offset + 3] = (byte)255; pixels[offset + 3] = 255;
} }
} }
image.SetPixels(pixelWidth, pixelHeight, pixels); image.SetPixels(pixelWidth, pixelHeight, pixels);
} }
#endregion
} }
} }

36
src/ImageProcessor/Formats/Jpg/JpegEncoder.cs

@ -1,11 +1,12 @@
// =============================================================================== // --------------------------------------------------------------------------------------------------------------------
// JpegEncoder.cs // <copyright file="JpegEncoder.cs" company="James South">
// .NET Image Tools // Copyright © James South and contributors.
// =============================================================================== // Licensed under the Apache License, Version 2.0.
// Copyright (c) .NET Image Tools Development Group. // </copyright>
// All rights reserved. // <summary>
// =============================================================================== // Encoder for writing the data image to a stream in jpg format.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor.Formats namespace ImageProcessor.Formats
{ {
@ -19,9 +20,7 @@ namespace ImageProcessor.Formats
/// </summary> /// </summary>
public class JpegEncoder : IImageEncoder public class JpegEncoder : IImageEncoder
{ {
#region Properties private int quality = 100;
private int _quality = 100;
/// <summary> /// <summary>
/// Gets or sets the quality, that will be used to encode the image. Quality /// Gets or sets the quality, that will be used to encode the image. Quality
/// index must be between 0 and 100 (compression from max to min). /// index must be between 0 and 100 (compression from max to min).
@ -29,22 +28,15 @@ namespace ImageProcessor.Formats
/// <value>The quality of the jpg image from 0 to 100.</value> /// <value>The quality of the jpg image from 0 to 100.</value>
public int Quality public int Quality
{ {
get { return _quality; } get { return this.quality; }
set { _quality = value; } set { this.quality = value.Clamp(1, 100); }
} }
#endregion
#region IImageEncoder Members
/// <summary> /// <summary>
/// Gets the default file extension for this encoder. /// Gets the default file extension for this encoder.
/// </summary> /// </summary>
/// <value>The default file extension for this encoder.</value> /// <value>The default file extension for this encoder.</value>
public string Extension public string Extension => "JPG";
{
get { return "JPG"; }
}
/// <summary> /// <summary>
/// Indicates if the image encoder supports the specified /// Indicates if the image encoder supports the specified
@ -114,7 +106,5 @@ namespace ImageProcessor.Formats
JpegImage jpg = new JpegImage(rows, Colorspace.RGB); JpegImage jpg = new JpegImage(rows, Colorspace.RGB);
jpg.WriteJpeg(stream, new CompressionParameters { Quality = this.Quality }); jpg.WriteJpeg(stream, new CompressionParameters { Quality = this.Quality });
} }
#endregion
} }
} }

2
src/ImageProcessor/Formats/Jpg/LibJpeg/Classic/Internal/my_upsampler.cs

@ -347,7 +347,7 @@ namespace BitMiracle.LibJpeg.Classic.Internal
int row = m_upsampleRowOffset + inrow; int row = m_upsampleRowOffset + inrow;
int outIndex = 0; int outIndex = 0;
for (int col = 0; col < m_cinfo.m_output_width; col++) for (int col = 0; outIndex < m_cinfo.m_output_width; col++)
{ {
byte invalue = input_data[row][col]; /* don't need GETJSAMPLE() here */ byte invalue = input_data[row][col]; /* don't need GETJSAMPLE() here */
output_data[inrow][outIndex] = invalue; output_data[inrow][outIndex] = invalue;

82
src/ImageProcessor/Formats/Jpg/LibJpeg/DecompressorToJpegImage.cs

@ -1,30 +1,54 @@
using System; // --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic; // <copyright file="DecompressorToJpegImage.cs" company="James South">
using System.IO; // Copyright © James South and contributors.
using System.Text; // Licensed under the Apache License, Version 2.0.
using Nine.Imaging; // </copyright>
// <summary>
// Decompresses a jpeg image.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace BitMiracle.LibJpeg namespace BitMiracle.LibJpeg
{ {
using System;
using System.IO;
using ImageProcessor; using ImageProcessor;
class DecompressorToJpegImage : IDecompressDestination /// <summary>
/// Decompresses a jpeg image.
/// </summary>
internal class DecompressorToJpegImage : IDecompressDestination
{ {
private JpegImage m_jpegImage; /// <summary>
/// The jpeg image.
/// </summary>
private readonly JpegImage jpegImage;
/// <summary>
/// Initializes a new instance of the <see cref="DecompressorToJpegImage"/> class.
/// </summary>
/// <param name="jpegImage">
/// The jpeg image.
/// </param>
internal DecompressorToJpegImage(JpegImage jpegImage) internal DecompressorToJpegImage(JpegImage jpegImage)
{ {
m_jpegImage = jpegImage; this.jpegImage = jpegImage;
} }
public Stream Output /// <summary>
{ /// Gets the stream with decompressed data.
get /// </summary>
{ public Stream Output => null;
return null;
}
}
/// <summary>
/// Sets the image attributes.
/// </summary>
/// <param name="parameters">
/// The <see cref="LoadedImageAttributes"/> containing attributes.
/// </param>
/// <exception cref="ArgumentOutOfRangeException">
/// </exception>
public void SetImageAttributes(LoadedImageAttributes parameters) public void SetImageAttributes(LoadedImageAttributes parameters)
{ {
if (parameters.Width > ImageBase.MaxWidth || parameters.Height > ImageBase.MaxHeight) if (parameters.Width > ImageBase.MaxWidth || parameters.Height > ImageBase.MaxHeight)
@ -33,23 +57,37 @@ namespace BitMiracle.LibJpeg
$"The input jpg '{ parameters.Width }x{ parameters.Height }' is bigger then the max allowed size '{ ImageBase.MaxWidth }x{ ImageBase.MaxHeight }'"); $"The input jpg '{ parameters.Width }x{ parameters.Height }' is bigger then the max allowed size '{ ImageBase.MaxWidth }x{ ImageBase.MaxHeight }'");
} }
m_jpegImage.Width = parameters.Width; this.jpegImage.Width = parameters.Width;
m_jpegImage.Height = parameters.Height; this.jpegImage.Height = parameters.Height;
m_jpegImage.BitsPerComponent = 8; this.jpegImage.BitsPerComponent = 8;
m_jpegImage.ComponentsPerSample = (byte)parameters.ComponentsPerSample; this.jpegImage.ComponentsPerSample = (byte)parameters.ComponentsPerSample;
m_jpegImage.Colorspace = parameters.Colorspace; this.jpegImage.Colorspace = parameters.Colorspace;
} }
/// <summary>
/// Begins writing.
/// </summary>
/// <remarks>Not implemented.</remarks>
public void BeginWrite() public void BeginWrite()
{ {
} }
/// <summary>
/// Processes the given row of pixels.
/// </summary>
/// <param name="row">
/// The <see cref="T:byte[]"/> representing the row.
/// </param>
public void ProcessPixelsRow(byte[] row) public void ProcessPixelsRow(byte[] row)
{ {
SampleRow samplesRow = new SampleRow(row, m_jpegImage.Width, m_jpegImage.BitsPerComponent, m_jpegImage.ComponentsPerSample); SampleRow samplesRow = new SampleRow(row, this.jpegImage.Width, this.jpegImage.BitsPerComponent, this.jpegImage.ComponentsPerSample);
m_jpegImage.addSampleRow(samplesRow); this.jpegImage.addSampleRow(samplesRow);
} }
/// <summary>
/// Ends write.
/// </summary>
/// <remarks>Not implemented.</remarks>
public void EndWrite() public void EndWrite()
{ {
} }

217
src/ImageProcessor/Formats/Jpg/LibJpeg/IDecompressDestination.cs

@ -1,19 +1,21 @@
using System; // --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic; // <copyright file="IDecompressDestination.cs" company="James South">
using System.IO; // Copyright © James South and contributors.
using System.Text; // Licensed under the Apache License, Version 2.0.
// </copyright>
using BitMiracle.LibJpeg.Classic; // --------------------------------------------------------------------------------------------------------------------
namespace BitMiracle.LibJpeg namespace BitMiracle.LibJpeg
{ {
using System.IO;
/// <summary> /// <summary>
/// Common interface for processing of decompression. /// Common interface for processing of decompression.
/// </summary> /// </summary>
interface IDecompressDestination internal interface IDecompressDestination
{ {
/// <summary> /// <summary>
/// Strean with decompressed data /// Gets the stream with decompressed data.
/// </summary> /// </summary>
Stream Output Stream Output
{ {
@ -21,208 +23,29 @@ namespace BitMiracle.LibJpeg
} }
/// <summary> /// <summary>
/// Implementor of this interface should process image properties received from decompressor. /// Sets the image attributes.
/// </summary> /// </summary>
/// <param name="parameters">Image properties</param> /// <param name="parameters">
/// The <see cref="LoadedImageAttributes"/> containing attributes.
/// </param>
void SetImageAttributes(LoadedImageAttributes parameters); void SetImageAttributes(LoadedImageAttributes parameters);
/// <summary> /// <summary>
/// Called before decompression /// Begins writing. Called before decompression
/// </summary> /// </summary>
void BeginWrite(); void BeginWrite();
/// <summary> /// <summary>
/// It called during decompression - pass row of pixels from JPEG /// Processes the given row of pixels.
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row">
/// The <see cref="T:byte[]"/> representing the row.
/// </param>
void ProcessPixelsRow(byte[] row); void ProcessPixelsRow(byte[] row);
/// <summary> /// <summary>
/// Called after decompression /// Ends writing. Called after decompression
/// </summary> /// </summary>
void EndWrite(); void EndWrite();
} }
/// <summary>
/// Holds parameters of image for decompression (IDecomressDesination)
/// </summary>
class LoadedImageAttributes
{
private Colorspace m_colorspace;
private bool m_quantizeColors;
private int m_width;
private int m_height;
private int m_componentsPerSample;
private int m_components;
private int m_actualNumberOfColors;
private byte[][] m_colormap;
private DensityUnit m_densityUnit;
private int m_densityX;
private int m_densityY;
/* Decompression processing parameters --- these fields must be set before
* calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
* them to default values.
*/
// colorspace for output
public Colorspace Colorspace
{
get
{
return m_colorspace;
}
internal set
{
m_colorspace = value;
}
}
// true=colormapped output wanted
public bool QuantizeColors
{
get
{
return m_quantizeColors;
}
internal set
{
m_quantizeColors = value;
}
}
/* Description of actual output image that will be returned to application.
* These fields are computed by jpeg_start_decompress().
* You can also use jpeg_calc_output_dimensions() to determine these values
* in advance of calling jpeg_start_decompress().
*/
// scaled image width
public int Width
{
get
{
return m_width;
}
internal set
{
m_width = value;
}
}
// scaled image height
public int Height
{
get
{
return m_height;
}
internal set
{
m_height = value;
}
}
// # of color components in out_color_space
public int ComponentsPerSample
{
get
{
return m_componentsPerSample;
}
internal set
{
m_componentsPerSample = value;
}
}
// # of color components returned. it is 1 (a colormap index) when
// quantizing colors; otherwise it equals out_color_components.
public int Components
{
get
{
return m_components;
}
internal set
{
m_components = value;
}
}
/* When quantizing colors, the output colormap is described by these fields.
* The application can supply a colormap by setting colormap non-null before
* calling jpeg_start_decompress; otherwise a colormap is created during
* jpeg_start_decompress or jpeg_start_output.
* The map has out_color_components rows and actual_number_of_colors columns.
*/
// number of entries in use
public int ActualNumberOfColors
{
get
{
return m_actualNumberOfColors;
}
internal set
{
m_actualNumberOfColors = value;
}
}
// The color map as a 2-D pixel array
public byte[][] Colormap
{
get
{
return m_colormap;
}
internal set
{
m_colormap = value;
}
}
// These fields record data obtained from optional markers
// recognized by the JPEG library.
// JFIF code for pixel size units
public DensityUnit DensityUnit
{
get
{
return m_densityUnit;
}
internal set
{
m_densityUnit = value;
}
}
// Horizontal pixel density
public int DensityX
{
get
{
return m_densityX;
}
internal set
{
m_densityX = value;
}
}
// Vertical pixel density
public int DensityY
{
get
{
return m_densityY;
}
internal set
{
m_densityY = value;
}
}
}
} }

274
src/ImageProcessor/Formats/Jpg/LibJpeg/LoadedImageAttributes.cs

@ -0,0 +1,274 @@
namespace BitMiracle.LibJpeg
{
using BitMiracle.LibJpeg.Classic;
/// <summary>
/// Holds parameters of image for decompression (IDecomressDesination)
/// </summary>
class LoadedImageAttributes
{
/// <summary>
/// The m_colorspace.
/// </summary>
private Colorspace m_colorspace;
/// <summary>
/// The m_quantize colors.
/// </summary>
private bool m_quantizeColors;
/// <summary>
/// The m_width.
/// </summary>
private int m_width;
/// <summary>
/// The m_height.
/// </summary>
private int m_height;
/// <summary>
/// The m_components per sample.
/// </summary>
private int m_componentsPerSample;
/// <summary>
/// The m_components.
/// </summary>
private int m_components;
/// <summary>
/// The m_actual number of colors.
/// </summary>
private int m_actualNumberOfColors;
/// <summary>
/// The m_colormap.
/// </summary>
private byte[][] m_colormap;
/// <summary>
/// The m_density unit.
/// </summary>
private DensityUnit m_densityUnit;
/// <summary>
/// The m_density x.
/// </summary>
private int m_densityX;
/// <summary>
/// The m_density y.
/// </summary>
private int m_densityY;
/* Decompression processing parameters --- these fields must be set before
* calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
* them to default values.
*/
// colorspace for output
/// <summary>
/// Gets the colorspace.
/// </summary>
public Colorspace Colorspace
{
get
{
return this.m_colorspace;
}
internal set
{
this.m_colorspace = value;
}
}
// true=colormapped output wanted
/// <summary>
/// Gets a value indicating whether quantize colors.
/// </summary>
public bool QuantizeColors
{
get
{
return this.m_quantizeColors;
}
internal set
{
this.m_quantizeColors = value;
}
}
/* Description of actual output image that will be returned to application.
* These fields are computed by jpeg_start_decompress().
* You can also use jpeg_calc_output_dimensions() to determine these values
* in advance of calling jpeg_start_decompress().
*/
// scaled image width
/// <summary>
/// Gets the width.
/// </summary>
public int Width
{
get
{
return this.m_width;
}
internal set
{
this.m_width = value;
}
}
// scaled image height
/// <summary>
/// Gets the height.
/// </summary>
public int Height
{
get
{
return this.m_height;
}
internal set
{
this.m_height = value;
}
}
// # of color components in out_color_space
/// <summary>
/// Gets the components per sample.
/// </summary>
public int ComponentsPerSample
{
get
{
return this.m_componentsPerSample;
}
internal set
{
this.m_componentsPerSample = value;
}
}
// # of color components returned. it is 1 (a colormap index) when
// quantizing colors; otherwise it equals out_color_components.
/// <summary>
/// Gets the components.
/// </summary>
public int Components
{
get
{
return this.m_components;
}
internal set
{
this.m_components = value;
}
}
/* When quantizing colors, the output colormap is described by these fields.
* The application can supply a colormap by setting colormap non-null before
* calling jpeg_start_decompress; otherwise a colormap is created during
* jpeg_start_decompress or jpeg_start_output.
* The map has out_color_components rows and actual_number_of_colors columns.
*/
// number of entries in use
/// <summary>
/// Gets the actual number of colors.
/// </summary>
public int ActualNumberOfColors
{
get
{
return this.m_actualNumberOfColors;
}
internal set
{
this.m_actualNumberOfColors = value;
}
}
// The color map as a 2-D pixel array
/// <summary>
/// Gets the colormap.
/// </summary>
public byte[][] Colormap
{
get
{
return this.m_colormap;
}
internal set
{
this.m_colormap = value;
}
}
// These fields record data obtained from optional markers
// recognized by the JPEG library.
// JFIF code for pixel size units
/// <summary>
/// Gets the density unit.
/// </summary>
public DensityUnit DensityUnit
{
get
{
return this.m_densityUnit;
}
internal set
{
this.m_densityUnit = value;
}
}
// Horizontal pixel density
/// <summary>
/// Gets the density x.
/// </summary>
public int DensityX
{
get
{
return this.m_densityX;
}
internal set
{
this.m_densityX = value;
}
}
// Vertical pixel density
/// <summary>
/// Gets the density y.
/// </summary>
public int DensityY
{
get
{
return this.m_densityY;
}
internal set
{
this.m_densityY = value;
}
}
}
}

22
src/ImageProcessor/Image.cs

@ -48,23 +48,23 @@ namespace ImageProcessor
/// </summary> /// </summary>
private static readonly Lazy<List<IImageDecoder>> DefaultDecoders = private static readonly Lazy<List<IImageDecoder>> DefaultDecoders =
new Lazy<List<IImageDecoder>>(() => new List<IImageDecoder> new Lazy<List<IImageDecoder>>(() => new List<IImageDecoder>
{ {
new BmpDecoder(), new BmpDecoder(),
// new JpegDecoder(), new JpegDecoder(),
new PngDecoder(), new PngDecoder(),
// new GifDecoder(), // new GifDecoder(),
}); });
/// <summary> /// <summary>
/// The default collection of <see cref="IImageEncoder"/>. /// The default collection of <see cref="IImageEncoder"/>.
/// </summary> /// </summary>
private static readonly Lazy<List<IImageEncoder>> DefaultEncoders = private static readonly Lazy<List<IImageEncoder>> DefaultEncoders =
new Lazy<List<IImageEncoder>>(() => new List<IImageEncoder> new Lazy<List<IImageEncoder>>(() => new List<IImageEncoder>
{ {
new BmpEncoder(), new BmpEncoder(),
// new JpegEncoder(), new JpegEncoder(),
new PngEncoder(), new PngEncoder()
}); });
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Image"/> class. /// Initializes a new instance of the <see cref="Image"/> class.

78
src/ImageProcessor/ImageProcessor.csproj

@ -56,6 +56,83 @@
<Compile Include="Formats\Gif\Quantizer\IQuantizer.cs" /> <Compile Include="Formats\Gif\Quantizer\IQuantizer.cs" />
<Compile Include="Formats\Gif\Quantizer\OctreeQuantizer.cs" /> <Compile Include="Formats\Gif\Quantizer\OctreeQuantizer.cs" />
<Compile Include="Formats\Gif\Quantizer\Quantizer.cs" /> <Compile Include="Formats\Gif\Quantizer\Quantizer.cs" />
<Compile Include="Formats\Jpg\JpegDecoder.cs" />
<Compile Include="Formats\Jpg\JpegEncoder.cs" />
<Compile Include="Formats\Jpg\LibJpeg\BitmapDestination.cs" />
<Compile Include="Formats\Jpg\LibJpeg\BitStream.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\DensityUnit.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\bitread_perm_state.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\bitread_working_state.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\ComponentBuffer.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\d_derived_tbl.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\huff_entropy_decoder.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\huff_entropy_encoder.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\JpegUtils.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_color_converter.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_color_deconverter.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_color_quantizer.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_comp_master.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_c_coef_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_c_main_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_c_prep_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_decomp_master.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_downsampler.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_d_coef_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_d_main_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_d_post_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_entropy_decoder.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_entropy_encoder.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_forward_dct.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_input_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_inverse_dct.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_marker_reader.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_marker_writer.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_scan_info.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\jpeg_upsampler.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\J_BUF_MODE.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_1pass_cquantizer.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_2pass_cquantizer.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_c_coef_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_destination_mgr.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_merged_upsampler.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_source_mgr.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_trans_c_coef_controller.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\my_upsampler.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\phuff_entropy_decoder.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\Internal\phuff_entropy_encoder.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\JBLOCK.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\JHUFF_TBL.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\JpegConstants.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_common_struct.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_component_info.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_compress_struct.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_decompress_struct.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_destination_mgr.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_error_mgr.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\JPEG_MARKER.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_marker_struct.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_progress_mgr.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jpeg_source_mgr.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\JQUANT_TBL.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\jvirt_array.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\J_COLOR_SPACE.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\J_DCT_METHOD.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\J_DITHER_MODE.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\J_MESSAGE_CODE.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Classic\ReadResult.cs" />
<Compile Include="Formats\Jpg\LibJpeg\CompressionParameters.cs" />
<Compile Include="Formats\Jpg\LibJpeg\DecompressionParameters.cs" />
<Compile Include="Formats\Jpg\LibJpeg\DecompressorToJpegImage.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Enumerations.cs" />
<Compile Include="Formats\Jpg\LibJpeg\IDecompressDestination.cs" />
<Compile Include="Formats\Jpg\LibJpeg\IRawImage.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Jpeg.cs" />
<Compile Include="Formats\Jpg\LibJpeg\JpegImage.cs" />
<Compile Include="Formats\Jpg\LibJpeg\LoadedImageAttributes.cs" />
<Compile Include="Formats\Jpg\LibJpeg\RawImage.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Sample.cs" />
<Compile Include="Formats\Jpg\LibJpeg\SampleRow.cs" />
<Compile Include="Formats\Jpg\LibJpeg\Utils.cs" />
<Compile Include="Formats\Png\PngDecoder.cs" /> <Compile Include="Formats\Png\PngDecoder.cs" />
<Compile Include="Formats\Png\PngDecoderCore.cs" /> <Compile Include="Formats\Png\PngDecoderCore.cs" />
<Compile Include="Formats\Png\PngEncoder.cs" /> <Compile Include="Formats\Png\PngEncoder.cs" />
@ -94,6 +171,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Formats\Jpg\README.md" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

1
src/ImageProcessor/ImageProcessor.csproj.DotSettings

@ -9,5 +9,6 @@
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cgif/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cgif/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cgif_005Cquantizer/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cgif_005Cquantizer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cjpg/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cjpg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cjpg_005Clibjpeg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cpng/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=formats_005Cpng/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=numerics/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=numerics/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

6
tests/ImageProcessor.Tests/Formats/EncoderDecoderTests.cs

@ -13,10 +13,10 @@
[Theory] [Theory]
//[InlineData("TestImages/Car.bmp")] //[InlineData("TestImages/Car.bmp")]
//[InlineData("TestImages/Portrait.png")] //[InlineData("TestImages/Portrait.png")]
//[InlineData("TestImages/Backdrop.jpg")] [InlineData("../../TestImages/Formats/Jpg/Backdrop.jpg")]
//[InlineData("TestImages/Windmill.gif")] //[InlineData("TestImages/Windmill.gif")]
[InlineData("../../TestImages/Formats/Bmp/Car.bmp")] //[InlineData("../../TestImages/Formats/Bmp/Car.bmp")]
[InlineData("../../TestImages/Formats/Png/cmyk.png")] //[InlineData("../../TestImages/Formats/Png/cmyk.png")]
public void DecodeThenEncodeImageFromStreamShouldSucceed(string filename) public void DecodeThenEncodeImageFromStreamShouldSucceed(string filename)
{ {
if (!Directory.Exists("Encoded")) if (!Directory.Exists("Encoded"))

3
tests/ImageProcessor.Tests/TestImages/Formats/Jpg/Backdrop.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:048c66eb1d5257d36319da28ca24837429e0604682e4ebb74778175fbbb18db9
size 49595
Loading…
Cancel
Save