473,507 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hod do you make a Bitmap bigger

How can I increase the size of a bitmap while preserving the image in it.

I tried (among many other things) :

b1 = New Drawing.Bitmap(b1, picData.Width, picData.Height)

and it doesn't seem to work.

I've searched the net and can find nobody that does it.

Is this a difficult thing to do? I can't seem to find the combination that
works.

Thanks for any help,

Cal
Nov 20 '05 #1
8 1946
Hi Cal,

I'd recommend 3 products: microangelo, icon forge and icon gragger.

HTH,

Bernie Yaeger

" active" <ac****@REMOVEa-znet.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
How can I increase the size of a bitmap while preserving the image in it.

I tried (among many other things) :

b1 = New Drawing.Bitmap(b1, picData.Width, picData.Height)

and it doesn't seem to work.

I've searched the net and can find nobody that does it.

Is this a difficult thing to do? I can't seem to find the combination that
works.

Thanks for any help,

Cal

Nov 20 '05 #2
Thanks but I'm talking VB.NET
cal

PS At least for a minute I thought someone had told me how - thanks for that
happy period.
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:On**************@TK2MSFTNGP12.phx.gbl...
Hi Cal,

I'd recommend 3 products: microangelo, icon forge and icon gragger.

HTH,

Bernie Yaeger

" active" <ac****@REMOVEa-znet.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
How can I increase the size of a bitmap while preserving the image in it.
I tried (among many other things) :

b1 = New Drawing.Bitmap(b1, picData.Width, picData.Height)

and it doesn't seem to work.

I've searched the net and can find nobody that does it.

Is this a difficult thing to do? I can't seem to find the combination that works.

Thanks for any help,

Cal


Nov 20 '05 #3
* " active" <ac****@REMOVEa-znet.com> scripsit:
How can I increase the size of a bitmap while preserving the image in it.

I tried (among many other things) :

b1 = New Drawing.Bitmap(b1, picData.Width, picData.Height)

and it doesn't seem to work.

I've searched the net and can find nobody that does it.

Is this a difficult thing to do? I can't seem to find the combination that
works.


Create a new bitmap object with the bigger size, then draw the old image
onto it. Sample for painting an image on another:

\\\
Dim b As New Bitmap(200, 200, ...)
Dim g As Graphics = Graphics.FromImage(b)
g.DrawImage(...)
g.DrawImage(...)
g.DrawImage(...)
g.DrawImage(...)
g.Dispose()
b.Save(...)
b.Dispose()
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
I have a bitmap, b1, that I need to enlarge while retaining the contents.
I tried to adapt your input but could not make it work.
I cut and paste to present what I have. picData is a PictureBox
I've tried creating b with the b1 in the constructor
I've tried cloning b1
I've tried everything I can think of

Private b1 As Drawing.Bitmap
Private g1 As Graphics

-snip Things like the following:
g1.DrawString( -snip Can not redo these statements to recreate bitmap

-snip Need to resize the bitmap since picData has resized - Does not work
Private Sub picData_Resize(ByVal se -snip
Dim b = New Drawing.Bitmap(picData.Width, picData.Height)
Dim g As Graphics = Graphics.FromImage(b)
g.DrawImage(b1, 0, 0)
b1 = b
g1 = Graphics.FromImage(b1)
picData.Invalidate()

Private Sub picData_Paint( -snip
e.Graphics.DrawImage(b1, 0, 0)
End Sub
Nov 20 '05 #5
Cor
Hi active,

You can have a look for this to the drawing encoder class
Before you do it you have to no the codec of the picture or use a codec.

Most samples are in C#

You also can visit the dotnet drawing newsgroup for this.

I hope this helps?

Cor

Nov 20 '05 #6
'Load the original bitmap.

dim bm as bitmap=Bitmap.FromFile("filename....")

'create a bigger one

dim bigbm as new Bitmap(bm.Width*2, bm.Height*2)

'get a graphics for the copy so you can draw on it.

dim g as Graphics=Graphics.FromImage(bigbm)

'draw the original to the graphics.

g.DrawImage(bm,new Rectangle(0,0,bigbm.Width,
bigbm.Height),0,0,bm.Width,bm.Height,GraphicsUnit. Pixel)

'dispose of the graphics.

g.Dispose()

'and the original

bm.Dispose() 'this closes the file.

'now save the bigger image...

bigbm.Save("filename...",ImageFormat.Bmp)
--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

" active" <ac****@REMOVEa-znet.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
How can I increase the size of a bitmap while preserving the image in it.

I tried (among many other things) :

b1 = New Drawing.Bitmap(b1, picData.Width, picData.Height)

and it doesn't seem to work.

I've searched the net and can find nobody that does it.

Is this a difficult thing to do? I can't seem to find the combination that
works.

Thanks for any help,

Cal

Nov 20 '05 #7
I ralize now that some of my problem was that the form containing the
Usercontrol that contained the PictureBox had a reference to the graphics
object I needed to update when I changed bitmaps.

I'll try both of your suggestions. I assume I'll be able to find the info about
the codec class in Help or MSDN since I don't understand what "Before you do it
you have to no the codec of the picture or use a codec." means.

Thanks for the info
Cal
Nov 20 '05 #8
The bitmap I have is the one I use to Paint the PictureBox (picData) with.
I get it like this:

Dim g As Graphics = picData.CreateGraphics

b1 = New Drawing.Bitmap(picData.Width, picData.Height, g)

g.Dispose()

g1 = Graphics.FromImage(b1)
I need to leave the resize routine with b1 and g1 set to the new values.
I think that's what I'm having trouble doing because I can't draw after.

Thanks for the input
(especially if you revise it to fit the above, which I havn't had much luck
doing),
Cal

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
'Load the original bitmap.

dim bm as bitmap=Bitmap.FromFile("filename....")

'create a bigger one

dim bigbm as new Bitmap(bm.Width*2, bm.Height*2)

'get a graphics for the copy so you can draw on it.

dim g as Graphics=Graphics.FromImage(bigbm)

'draw the original to the graphics.

g.DrawImage(bm,new Rectangle(0,0,bigbm.Width,
bigbm.Height),0,0,bm.Width,bm.Height,GraphicsUnit. Pixel)

'dispose of the graphics.

g.Dispose()

'and the original

bm.Dispose() 'this closes the file.

'now save the bigger image...

bigbm.Save("filename...",ImageFormat.Bmp)
--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2123
by: Manuel Adam | last post by:
Hello! I am using an web application to resize some JPG files. First I use WebClient to download the Image from the Web. Then I use the Bitmap Class to Save it as a different file. Later I...
4
1106
by: Stu | last post by:
Hi, What is the quickest (performance wise) way to copy one small bitmap to certain coordinates of a bigger bitmap? I'm currently doing it by looping through each pixel....and I get the feeling...
9
1666
by: Peter Proost | last post by:
Hi group, I've got a question about the size of a saved bitmap. What I need to do is open a bitmap if it needs resizing, resize and save it. This isn't a problem, but the problem I have is that the...
8
10268
by: Oberfuhrer | last post by:
I am an old mathematician, who in my sparetime work on a topic oriented math application. I have converted from old, dry Fortran to the more intuitive and juicy VB.net and Windows. In...
7
8222
by: Fir5tSight | last post by:
Hi All, I used the following code in C#: using System.Drawing; //blah blah blah Bitmap bmp = new Bitmap();
2
3190
by: Robinson | last post by:
Hi, Can anyone point me towards a good drag/drop tutorial that allows me to create/render my own drag-cursor (i.e. for instance, if I wish to drag a list item, I can render the list item at the...
14
11861
by: eliss.carmine | last post by:
I'm using TCP/IP to send a Bitmap object over Sockets. This is my first time using C# at all so I don't know if this is the "right" way to do it. I've already found out several times the way I was...
8
4290
by: Joergen Bech | last post by:
Suppose I have Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed) I cannot use Dim g As Graphics = Graphics.FromImage(bmdest) Dim hdc As IntPtr = g.GetHdc() as the...
6
2435
by: \Frank\ | last post by:
I trying to learn what a Bitmap is. Not a Managed Bitmap Object but one that, for example, comes from the clipboard with CF_BITMAP. I'm guessing that a CompatableBitmap is an array of indices...
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.