Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to Convert the .bmp and .jpg Images into .gif Image

How to Convert the .bmp and .jpg Images into .gif Image

Scheduled Pinned Locked Moved ASP.NET
tutorial
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robymon
    wrote on last edited by
    #1

    While Saving How we can convert the selected .bmp and jpeg or anyother image into .gif Image. How we can resize the image Eg. Reduce the Height and Width.

    P 1 Reply Last reply
    0
    • R Robymon

      While Saving How we can convert the selected .bmp and jpeg or anyother image into .gif Image. How we can resize the image Eg. Reduce the Height and Width.

      P Offline
      P Offline
      PCuong1983
      wrote on last edited by
      #2

      hi, U can use instance of Bitmap class like this Bitmap b = new Bitmap(...) ans use public Save method to save image with format ImageFormat.Gif and if u want to resize image , try this code , hope it help

      public Size CalculateDimensions(Size oldSize, int targetSize)
      {
      Size newSize = new Size();
      if (oldSize.Height > oldSize.Width)
      {
      newSize.Width = (int)(oldSize.Width * ((float)targetSize / (float)oldSize.Height));
      newSize.Height = targetSize;
      }
      else
      {
      newSize.Width = targetSize;
      newSize.Height = (int)(oldSize.Height * ((float)targetSize / (float)oldSize.Width));
      }
      return newSize;
      }

      the oldSize param is old size of your image the targetSize param is new dimension you want to resize to.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups