locked
How to reduce the image size? RRS feed

  • Question

  • Hi everyone,

    I have a program which takes some snapshot and pastes them in a ms-word document, but after finishing I found the document is too big, for example 75M for 15 pics. What is the best way to reduce the size of them? It can make compromise to reduce a little resolution or color bits. Any suggestion for me?

    Sincerely,

    Wednesday, June 17, 2015 8:18 AM

Answers

  • Can I reduce the resolution of a bitmap? And how to do it?

    Do you mean that you want to reduce the pixel dimension?  Resolution is something different, and only affects the way that the image is displayed or printed.

    The best way to change the size of an image is to use an image editing application, such as Irfanview.

    If you want to do it in VB .Net then use an override of the DrawImage method of the Graphics object to draw the image into a rectangle of a different size.

    Once you have the snapshot, create a Bitmap at the new image size.  Create a Graphics object from the bitmap
    https://msdn.microsoft.com/en-us/library/5y289054(v=vs.110).aspx

    and use DrawImage with the original bitmap and a rectangle the same sixe as the new bitmap to draw the image into the new bitmap
    https://msdn.microsoft.com/en-us/library/yws82c40(v=vs.110).aspx

    • Proposed as answer by LeonCS Thursday, June 18, 2015 9:01 AM
    • Marked as answer by Youjun Tang Wednesday, June 24, 2015 8:21 AM
    Thursday, June 18, 2015 6:34 AM

All replies

  • There are many ways, not "best" ways, if that was the case there was one way.


    Success
    Cor

    Wednesday, June 17, 2015 8:47 AM
  • What is the best way to reduce the size of them?

    Your options are:
      Reduce the size (pixel dimensions) of the images
      Increase the compression (if available)
      Use a different image storage format

    To find the 'best' way to get what you want you should use an image management utility such as Irfanview and experiment with the different possibilities.  When you decide which one you want to use you can implement it in VB (although the image management utility will probably do a better job).

    Wednesday, June 17, 2015 9:46 AM
  • Can I reduce the resolution of a bitmap? And how to do it?
    Thursday, June 18, 2015 5:49 AM
  • Can I reduce the resolution of a bitmap? And how to do it?

    Do you mean that you want to reduce the pixel dimension?  Resolution is something different, and only affects the way that the image is displayed or printed.

    The best way to change the size of an image is to use an image editing application, such as Irfanview.

    If you want to do it in VB .Net then use an override of the DrawImage method of the Graphics object to draw the image into a rectangle of a different size.

    Once you have the snapshot, create a Bitmap at the new image size.  Create a Graphics object from the bitmap
    https://msdn.microsoft.com/en-us/library/5y289054(v=vs.110).aspx

    and use DrawImage with the original bitmap and a rectangle the same sixe as the new bitmap to draw the image into the new bitmap
    https://msdn.microsoft.com/en-us/library/yws82c40(v=vs.110).aspx

    • Proposed as answer by LeonCS Thursday, June 18, 2015 9:01 AM
    • Marked as answer by Youjun Tang Wednesday, June 24, 2015 8:21 AM
    Thursday, June 18, 2015 6:34 AM