rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net
rotate and crop image in vb.net rotate and crop image in vb.net
rotate and crop image in vb.net
Go Back  Xtreme Visual Basic Talk > > > rotate and crop image in vb.net


Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2005, 07:59 PM
justplainsoccer justplainsoccer is offline
Freshman
 
Join Date: Nov 2003
Posts: 49
Default rotate and crop image in vb.net


i would like to rotate and crop an image in vb.net. I realize that i can rotate using the graphics class. but how do i get it back to an image? i dont want to draw it out, i want it to go back to the image class. is that possible? thanks.
Reply With Quote
  #2  
Old 01-05-2005, 08:09 PM
piggybank1974's Avatar
piggybank1974 piggybank1974 is offline
Ultimate Contributor
 
Join Date: Mar 2002
Location: weston-super-mare(UK)
Posts: 1,795
Lightbulb

you want something like this:

Code:
Dim imagefile As Bitmap Dim TempString As String Dim gfx As Graphics = Me.CreateGraphics TempString = "The Bitmap Map file you want to rotate" imagefile = New Bitmap(TempString) gfx.Clear(Color.White) gfx.ResetTransform() gfx.TranslateTransform(64.0F, 64.0F) 'center. half of the original image gfx.RotateTransform(45) ' rotation degree gfx.DrawImage(imagefile, (-imagefile.Width \ 2), -imagefile.Height \ 2)
the pig..
Reply With Quote
  #3  
Old 01-05-2005, 08:16 PM
justplainsoccer justplainsoccer is offline
Freshman
 
Join Date: Nov 2003
Posts: 49
Default

ya i want something like that, but then i want it in image form..

i know this wont work but i want it to

Code:
dim myImg as System.Drawing.Bitmap

'..all your code....

myImg = gfx
Reply With Quote
  #4  
Old 01-05-2005, 08:19 PM
justplainsoccer justplainsoccer is offline
Freshman
 
Join Date: Nov 2003
Posts: 49
Default

Code:
Public Sub RotateImg() Dim newBitmap As Bitmap Dim myGraphics As Graphics Dim picStream As New System.IO.MemoryStream Dim fntArial As Font = New Font("Arial", 12) myGraphics = Graphics.FromImage(myImg) myGraphics.RotateTransform(45.0F) Me.pctMain.Image = myImg End Sub

this doesnt work...
Reply With Quote
  #5  
Old 01-06-2005, 10:14 AM
Iceplug's Avatar
Iceplugrotate and crop image in vb.net Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Metaphors:
The Graphics object is not visual in any way. A graphics object is more or less the artist who draws your pictures. You do not want the artist to appear in your picture , so this is how you should use the Graphics object.
Applying a RotateTransform rotates the artist (not the picture) 45 degrees. The picture is unchanged, but if you asked the artist to draw while at 45 degrees, the new drawing would reflect this rotation.

Also, notice the graphics object only draws to what it is set to draw from. So, to draw to a bitmap, you have to get the graphics object to come from a bitmap.
Dim GFX As Graphics = Graphics.FromImage(myimg)
Drawing an image onto itself will not work.
So, what you can do is make another bitmap, create a graphics object from this bitmap, rotate GFX, and then draw the original image to this new bitmap.
From there, you can dispose the graphics object and reassign the myimg to the newly drawn bitmap.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #6  
Old 01-06-2005, 05:53 PM
justplainsoccer justplainsoccer is offline
Freshman
 
Join Date: Nov 2003
Posts: 49
Default

worked like a charm
taught me a few things too.. thanks!
Reply With Quote
Reply


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
rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net rotate and crop image in vb.net
rotate and crop image in vb.net
rotate and crop image in vb.net
 
rotate and crop image in vb.net
rotate and crop image in vb.net
 
-->