Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Go Back  Xtreme Visual Basic Talk > > > Shrink a bitmpap with high resolution


Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2013, 03:41 AM
chrldmp chrldmp is offline
Newcomer
 
Join Date: Feb 2013
Posts: 1
Default Shrink a bitmpap with high resolution


Hi to all,
I have written this code to resize (shrink) a bitmap:

Code:
  Public Function ResizeBitmap(bm_source As Bitmap, scale_factor As Double) As Bitmap
Dim bm_dest As New Bitmap(CInt(bm_source.Width * scale_factor), CInt(bm_source.Height * scale_factor))
      Dim g As Graphics = Graphics.FromImage(bm_dest)
      g.InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
      g.DrawImage(bm_source, 0, 0, bm_dest.Width + 1, bm_dest.Height + 1)
      Return bm_dest
  End Function
Now I do the following:
- Load a bitmap in my code, copy it to clipboard (Clipboard.SetImage(bmp)), paste it in Excel and manually resize it to half the size
- Then in my code use the above function to resize the bitmap to half the size, and then copy it in Excel
As expected, the bitmaps are exactly th same size, so the resizing works fine. But the bitmap that I resized manually in Excel has a much better resolution! How can I get the same resolution through code?
Thanks for your help,
Charlie
Reply With Quote
Reply

Tags
bitmap, resize, resolution


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
 
Shrink a bitmpap with high resolution
Shrink a bitmpap with high resolution
 
-->