Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a basic resize function I've used for a few of my applications that leverages GDI+</p> <pre><code>/// &lt;summary&gt; /// Resize image with GDI+ so that image is nice and clear with required size. /// &lt;/summary&gt; /// &lt;param name="SourceImage"&gt;Image to resize&lt;/param&gt; /// &lt;param name="NewHeight"&gt;New height to resize to.&lt;/param&gt; /// &lt;param name="NewWidth"&gt;New width to resize to.&lt;/param&gt; /// &lt;returns&gt;Image object resized to new dimensions.&lt;/returns&gt; /// &lt;remarks&gt;&lt;/remarks&gt; public static Image ImageResize(Image SourceImage, Int32 NewHeight, Int32 NewWidth) { System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(NewWidth, NewHeight, SourceImage.PixelFormat); if (bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format1bppIndexed | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format4bppIndexed | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format8bppIndexed | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Undefined | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.DontCare | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format16bppArgb1555 | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format16bppGrayScale) { throw new NotSupportedException("Pixel format of the image is not supported."); } System.Drawing.Graphics graphicsImage = System.Drawing.Graphics.FromImage(bitmap); graphicsImage.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality; graphicsImage.InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; graphicsImage.DrawImage(SourceImage, 0, 0, bitmap.Width, bitmap.Height); graphicsImage.Dispose(); return bitmap; } </code></pre> <p>I don't remember off the top of my head if it will work with GIFs, but you can give it a try.</p> <p>Note: I can't take full credit for this function. I pieced a few things together from some other samples online and made it work to my needs 8^D</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload