473,665 Members | 2,820 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 1957
Hi Cal,

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

HTH,

Bernie Yaeger

" active" <ac****@REMOV Ea-znet.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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*****@cherwe llinc.com> wrote in message
news:On******** ******@TK2MSFTN GP12.phx.gbl...
Hi Cal,

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

HTH,

Bernie Yaeger

" active" <ac****@REMOV Ea-znet.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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****@REMOV Ea-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.FromIm age(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.FromIm age(b)
g.DrawImage(b1, 0, 0)
b1 = b
g1 = Graphics.FromIm age(b1)
picData.Invalid ate()

Private Sub picData_Paint( -snip
e.Graphics.Draw Image(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.F romFile("filena me....")

'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=Graphi cs.FromImage(bi gbm)

'draw the original to the graphics.

g.DrawImage(bm, new Rectangle(0,0,b igbm.Width,
bigbm.Height),0 ,0,bm.Width,bm. Height,Graphics Unit.Pixel)

'dispose of the graphics.

g.Dispose()

'and the original

bm.Dispose() 'this closes the file.

'now save the bigger image...

bigbm.Save("fil ename...",Image Format.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****@REMOV Ea-znet.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.CreateG raphics

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

g.Dispose()

g1 = Graphics.FromIm age(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@_spamkille r_bobpowell.net > wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
'Load the original bitmap.

dim bm as bitmap=Bitmap.F romFile("filena me....")

'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=Graphi cs.FromImage(bi gbm)

'draw the original to the graphics.

g.DrawImage(bm, new Rectangle(0,0,b igbm.Width,
bigbm.Height),0 ,0,bm.Width,bm. Height,Graphics Unit.Pixel)

'dispose of the graphics.

g.Dispose()

'and the original

bm.Dispose() 'this closes the file.

'now save the bigger image...

bigbm.Save("fil ename...",Image Format.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
2133
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 delete the bigger picture. I had some trouble to resize Gif files with my function. So I used to convert Gif to Jpg first. Then I used the same as rescribed before.
4
1115
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 I've missed something a little more elegant! Thanks in advance, Stew
9
1669
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 original image has got an 8 bit indexed pixelformat, but you can't create a graphics object for this pixelformat so my bitmap uses the default pixelformat: Format32bppArgb, but this ofcourse result in a much larger file size (420kB instead of...
8
10270
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 particular i would like to have options to draw graphics straight to a bitmap object. A typical example would be to save a plot of a function y=f(x) drawn on a control.
7
8236
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
3202
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 cursor location as the user drags it around the screen). Has anyone successfully done this in VB.NET? How does it perform? Any pitfalls? Thanks,
14
11890
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 doing something was really inefficient and could reduce 10 lines of code with 2, etc. For reading, I am using a TcpClient and I call NetworkStream ns = client.GetStream(); to get a stream stream.Read(buffer, 0, buffer.Length);
8
4305
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 FromImage call will fail for indexed bitmaps.
6
2459
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 that point to the colors in a Palette of the display driver. So if I get a bitmap via CF_BITMAP I need to also get a Palette off the clipboard and realize it then display the bitmap. I believe "Realize it" means to put it into the display driver.
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4186
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
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 we have to send another system
2
1761
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.