Browse Source

Fixes issue #56

Former-commit-id: 0c2b86216666e2a6bd11668cb24f228017bfb638
pull/17/head
James South 12 years ago
parent
commit
86a67a068f
  1. 8
      src/ImageProcessor/Imaging/Formats/FormatBase.cs
  2. 8
      src/ImageProcessor/Imaging/Formats/GifFormat.cs
  3. 6
      src/ImageProcessor/Imaging/Formats/ISupportedImageFormat.cs
  4. 8
      src/ImageProcessor/Imaging/Formats/JpegFormat.cs
  5. 6
      src/ImageProcessor/Imaging/Formats/PngFormat.cs

8
src/ImageProcessor/Imaging/Formats/FormatBase.cs

@ -93,15 +93,15 @@ namespace ImageProcessor.Imaging.Formats
/// <summary> /// <summary>
/// Saves the current image to the specified output stream. /// Saves the current image to the specified output stream.
/// </summary> /// </summary>
/// <param name="memoryStream">The <see cref="T:System.IO.MemoryStream" /> to save the image information to.</param> /// <param name="stream">The <see cref="T:System.IO.Stream" /> to save the image information to.</param>
/// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param> /// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param>
/// <returns> /// <returns>
/// The <see cref="T:System.Drawing.Image" />. /// The <see cref="T:System.Drawing.Image" />.
/// </returns> /// </returns>
public virtual Image Save(MemoryStream memoryStream, Image image) public virtual Image Save(Stream stream, Image image)
{ {
image.Save(memoryStream, this.ImageFormat); image.Save(stream, this.ImageFormat);
memoryStream.Position = 0; stream.Position = 0;
return image; return image;
} }

8
src/ImageProcessor/Imaging/Formats/GifFormat.cs

@ -104,14 +104,14 @@ namespace ImageProcessor.Imaging.Formats
/// <summary> /// <summary>
/// Saves the current image to the specified output stream. /// Saves the current image to the specified output stream.
/// </summary> /// </summary>
/// <param name="memoryStream"> /// <param name="stream">
/// The <see cref="T:System.IO.MemoryStream" /> to save the image information to. /// The <see cref="T:System.IO.Stream" /> to save the image information to.
/// </param> /// </param>
/// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param> /// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param>
/// <returns> /// <returns>
/// The <see cref="T:System.Drawing.Image" />. /// The <see cref="T:System.Drawing.Image" />.
/// </returns> /// </returns>
public override Image Save(MemoryStream memoryStream, Image image) public override Image Save(Stream stream, Image image)
{ {
// TODO: Move this in here. It doesn't need to be anywhere else. // TODO: Move this in here. It doesn't need to be anywhere else.
ImageInfo imageInfo = image.GetImageInfo(this.ImageFormat, false); ImageInfo imageInfo = image.GetImageInfo(this.ImageFormat, false);
@ -121,7 +121,7 @@ namespace ImageProcessor.Imaging.Formats
image = new OctreeQuantizer(255, 8).Quantize(image); image = new OctreeQuantizer(255, 8).Quantize(image);
} }
return base.Save(memoryStream, image); return base.Save(stream, image);
} }
/// <summary> /// <summary>

6
src/ImageProcessor/Imaging/Formats/ISupportedImageFormat.cs

@ -86,8 +86,8 @@ namespace ImageProcessor.Imaging.Formats
/// <summary> /// <summary>
/// Saves the current image to the specified output stream. /// Saves the current image to the specified output stream.
/// </summary> /// </summary>
/// <param name="memoryStream"> /// <param name="stream">
/// The <see cref="T:System.IO.MemoryStream"/> to save the image information to. /// The <see cref="T:System.IO.Stream"/> to save the image information to.
/// </param> /// </param>
/// <param name="image"> /// <param name="image">
/// The <see cref="T:System.Drawing.Image"/> to save. /// The <see cref="T:System.Drawing.Image"/> to save.
@ -95,7 +95,7 @@ namespace ImageProcessor.Imaging.Formats
/// <returns> /// <returns>
/// The <see cref="T:System.Drawing.Image"/>. /// The <see cref="T:System.Drawing.Image"/>.
/// </returns> /// </returns>
Image Save(MemoryStream memoryStream, Image image); Image Save(Stream stream, Image image);
/// <summary> /// <summary>
/// Saves the current image to the specified file path. /// Saves the current image to the specified file path.

8
src/ImageProcessor/Imaging/Formats/JpegFormat.cs

@ -98,14 +98,14 @@ namespace ImageProcessor.Imaging.Formats
/// <summary> /// <summary>
/// Saves the current image to the specified output stream. /// Saves the current image to the specified output stream.
/// </summary> /// </summary>
/// <param name="memoryStream"> /// <param name="stream">
/// The <see cref="T:System.IO.MemoryStream" /> to save the image information to. /// The <see cref="T:System.IO.Stream" /> to save the image information to.
/// </param> /// </param>
/// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param> /// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param>
/// <returns> /// <returns>
/// The <see cref="T:System.Drawing.Image" />. /// The <see cref="T:System.Drawing.Image" />.
/// </returns> /// </returns>
public override Image Save(MemoryStream memoryStream, Image image) public override Image Save(Stream stream, Image image)
{ {
// Jpegs can be saved with different settings to include a quality setting for the JPEG compression. // Jpegs can be saved with different settings to include a quality setting for the JPEG compression.
// This improves output compression and quality. // This improves output compression and quality.
@ -117,7 +117,7 @@ namespace ImageProcessor.Imaging.Formats
if (imageCodecInfo != null) if (imageCodecInfo != null)
{ {
image.Save(memoryStream, imageCodecInfo, encoderParameters); image.Save(stream, imageCodecInfo, encoderParameters);
} }
} }

6
src/ImageProcessor/Imaging/Formats/PngFormat.cs

@ -68,19 +68,19 @@ namespace ImageProcessor.Imaging.Formats
/// <summary> /// <summary>
/// Saves the current image to the specified output stream. /// Saves the current image to the specified output stream.
/// </summary> /// </summary>
/// <param name="memoryStream">The <see cref="T:System.IO.MemoryStream" /> to save the image information to.</param> /// <param name="stream">The <see cref="T:System.IO.Stream" /> to save the image information to.</param>
/// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param> /// <param name="image">The <see cref="T:System.Drawing.Image" /> to save.</param>
/// <returns> /// <returns>
/// The <see cref="T:System.Drawing.Image" />. /// The <see cref="T:System.Drawing.Image" />.
/// </returns> /// </returns>
public override Image Save(MemoryStream memoryStream, Image image) public override Image Save(Stream stream, Image image)
{ {
if (this.IsIndexed) if (this.IsIndexed)
{ {
image = new OctreeQuantizer(255, 8).Quantize(image); image = new OctreeQuantizer(255, 8).Quantize(image);
} }
return base.Save(memoryStream, image); return base.Save(stream, image);
} }
/// <summary> /// <summary>

Loading…
Cancel
Save