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
  1. Home
  2. General Programming
  3. C#
  4. Image size

Image size

Scheduled Pinned Locked Moved C#
questioncsharpdatabasehelp
5 Posts 3 Posters 0 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.
  • B Offline
    B Offline
    Blue_Boy
    wrote on last edited by
    #1

    Hello, In my application I scan image (by C# code) and I save in local disc (by C# code),but problem is: the image is very large with size 1.50MB after it is saved in local disc. How can I decrease size of scaned image by C# code? Regards.


    I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

    R L 2 Replies Last reply
    0
    • B Blue_Boy

      Hello, In my application I scan image (by C# code) and I save in local disc (by C# code),but problem is: the image is very large with size 1.50MB after it is saved in local disc. How can I decrease size of scaned image by C# code? Regards.


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      You could compress it using GZip[^]. /ravi

      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

      1 Reply Last reply
      0
      • B Blue_Boy

        Hello, In my application I scan image (by C# code) and I save in local disc (by C# code),but problem is: the image is very large with size 1.50MB after it is saved in local disc. How can I decrease size of scaned image by C# code? Regards.


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Hi, Image.Save has many overloads, don't just use myImage.Save(myFilename); the file size depends on many things: - the image size in pixels (width and height); do you actually need that resolution? - the number of bits per pixel (e.g. 24 bpp); - the image format (see ImageFormat class). It all depends on what you want or need. You can reduce the number of pixels (by resampling the image), you can reduce the number of bits per pixel, or you can choose an image format with high(er) compression. Some formats have no compression, some can compress but don't do so by default, some (e.g. JPEG) perform compression and allow a choice from best quality to most compact. Another way to reduce image size is reducing the number of different colors to 256 and use an indexed image, that way it takes 1 byte per pixel. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).


        B 1 Reply Last reply
        0
        • L Luc Pattyn

          Hi, Image.Save has many overloads, don't just use myImage.Save(myFilename); the file size depends on many things: - the image size in pixels (width and height); do you actually need that resolution? - the number of bits per pixel (e.g. 24 bpp); - the image format (see ImageFormat class). It all depends on what you want or need. You can reduce the number of pixels (by resampling the image), you can reduce the number of bits per pixel, or you can choose an image format with high(er) compression. Some formats have no compression, some can compress but don't do so by default, some (e.g. JPEG) perform compression and allow a choice from best quality to most compact. Another way to reduce image size is reducing the number of different colors to 256 and use an indexed image, that way it takes 1 byte per pixel. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).


          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          Thank you for your answer,I figured out based on your suggestions. Finally I used ImageFormat and it works good. My best regards.


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

          L 1 Reply Last reply
          0
          • B Blue_Boy

            Thank you for your answer,I figured out based on your suggestions. Finally I used ImageFormat and it works good. My best regards.


            I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            You're welcome. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).


            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