bitmap rotation

I try to use the following code to rotate a image. first I read image from database. and change to bitmap. and rotate it. then save it back to database. HOWEVER, after about 10 times rotation the image quaility was getting worse and worse. can anybody tell me where did I do wrong? thanks


Dim ThumbNail() As Byte = objDataReader("picture")
Dim StreamT As New System.IO.MemoryStream()
Dim bmpT As Bitmap
StreamT.Write(ThumbNail, 0, ThumbNail.Length)
bmpT = New Bitmap(StreamT)
bmpT.RotateFlip(RotateFlipType.Rotate90FlipNone)
Dim InStreamT As New System.IO.MemoryStream()
bmpT.Save(InStreamT, ImageFormat.Jpeg)
Dim ThumbNailByte As Byte() = InStreamT.ToArray()
0
wbooster
7/5/2004 8:26:25 AM
asp.net.drawinggdi 1803 articles. 0 followers. Follow

6 Replies
609 Views

Similar Articles

[PageSpeed] 15
Get it on Google Play
Get it on Apple App Store

You are saving your image as jpeg. It is compressed file format. This way your image inevitably lost quality on each save. I suggest you to transform always source image, instead of overwriting it.
Leon Langleyben

MCSD, ASP.NET MVP

Blog
0
llangleyben
7/5/2004 9:31:37 AM
If I save it every time, there is no need to transform, while every time I am reading the file (this could save lots of work load for server). is there any other way to rotate an image, anybody? thanks
0
wbooster
7/7/2004 5:16:05 PM
You are rotating image 90 degrees. You need only 4 differenrt images to achieve this. Why don't you prepare them ahead and use static images from your page?
Leon Langleyben

MCSD, ASP.NET MVP

Blog
0
llangleyben
7/8/2004 11:43:55 AM
Dim compression As Long = ConfigurationSettings.AppSettings("compression")

Dim myImageCodecInfo As System.Drawing.Imaging.ImageCodecInfo
Dim myEncoder As System.Drawing.Imaging.Encoder
Dim myEncoderParameter As System.Drawing.Imaging.EncoderParameter
Dim myEncoderParameters As System.Drawing.Imaging.EncoderParameters
myImageCodecInfo = GetEncoderInfo("image/jpeg")
myEncoder = System.Drawing.Imaging.Encoder.Quality
myEncoderParameters = New System.Drawing.Imaging.EncoderParameters(1)
myEncoderParameter = New System.Drawing.Imaging.EncoderParameter(myEncoder, compression)
myEncoderParameters.Param(0) = myEncoderParameter
MyImage.Save(czfile, myImageCodecInfo, myEncoderParameters)
Try this code set the compression to 100 if you want high quality
Jean-Francois Borie
"Jef"
0
jef06
7/12/2004 1:08:56 PM
jef06,

1.
there is an error:
MyImage.Save(czfile, myImageCodecInfo, myEncoderParameters)
message:
Value cannot be null. Parameter name: encoder
2. there is no GetEncoderInfo(). is it:
Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo
Dim Encoders() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders()
Dim Codec As ImageCodecInfo
For Each Codec In Encoders
If Codec.FormatDescription.ToUpper = mimeType Then
Return Codec
End If
Next
End Function
0
wbooster
7/14/2004 6:59:27 AM
Private Function GetEncoderInfo(ByVal MYmimeType As String)

Dim i As Integer
Dim encoders As System.Drawing.Imaging.ImageCodecInfo() = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()
For i = 0 To (encoders.Length - 1)
If (encoders(i).MimeType = MYmimeType) Then
Return encoders(i)
End If
Next i
End Function

Jean-Francois Borie
"Jef"
0
jef06
7/14/2004 4:23:06 PM
Reply:

Similar Artilces:

How to rotate a bitmap?
I want to rotate a bitmap that has been loaded from a jpeg file into a TImage by 90 degrees. Don't want to save it or anything else. I have done a search and what I could find was procedures for arbitrary degree rotation, or did not work (or both). I have done this before back in the days when I wrote in assembler, but when I tried to do it using the TCanvas.Pixels property my image kept disappearing (dimensions set to 0). I also tried Charles Hacker's procedure (in the "How to rotate a png image?" thread further down (currently) in this forum. Same thing. Image disa...

Net:Net:Net::LDAP::FAQ
------_=_NextPart_001_01C6429F.D89AA417 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, Net::LDAP Net::LDAPS Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, ....) password? I don't like to write the secret password to the perl file. Best regards Barbara Wilbert ------_=_NextPart_001_01C6429F.D89AA417-- Wilbert Barbara (CI/OSI) * wrote: > Hello, > > Net::LDAP > Net::LDAPS > > Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, > ......

rotate bitmap in dw
I'm trying to rotate a image within datawindow, but I not find how do it. What can I do? Thank you for your answers Marco M. There's no way to do it in the datawindow directly. I would image that you could use a third party API to rotate the image and save it to a temp file. You can then use this new temp file to reset the picture control in the datawindow. Brad marmozzo wrote: > I'm trying to rotate a image within datawindow, but I not find how do > it. What can I do? > Thank you for your answers > > Marco M. > -- Join the ...

Rotating the controls in .net
Hi i wann to rotate the controls in .net ie i am able to get the image/text rotation to the specific angle but i am unable to rotate the control itself. Thanks in advance Regards sesha ...

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! Have a look into this links http://en.wikipedia.org/wiki/.NET_Framework http://blogs.msdn.com/mohammadakif/archive/2006/12/03/net-3-0-different-versions-of-the-net-framework.aspx http://www.codeproject.com/aspnet/ComparisonASP1xASP20.aspAshok Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that m...

Net Farmers net
Has anyone been able to access any of the tests at http://suicide.netfarmers.net ? I can get the default page but none of the tests appear to be operating over the last several weeks. -- CK I just tested and works as usual!!!Every session TCP_error,because my Shields_guard is intact<<G>> -- Regard: Joh@nnes� 1216771 Ont.Inc. "Nothing is more damaging to a new truth than an old error" "CK" <ckphalon@lascenltd.com> wrote in message news:9i45gg$1qa9$1@news.grc.com... : Has anyone been able to access any of the tests at : http://suicide...

To .NET or not .NET, that is the question
I'm running WinXP pro 32-bit, meaning I've got the version 1-dot-something of .NET that XP came with. I've been looking for various softwares, and more and more often come across .NET version 2 being prerequisite. No urgency for me re. my questions to this group - so far I have just decided to hit the red X on those download pages - but the desire for this newer version of .NET seems to be growing for me. Firstly, according to my (limited) research, newer .NET versions are inclusive of the previous ones, and the current version seems to be 3.5. So if I go for i...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

net send in .net
Hi,  I am trying to execute net send comman in my vb.net code. But I am getting "win32 exception unhandled error". Please help me. My code is:Dim psi As New ProcessStartInfo() psi.UseShellExecute = False psi.FileName = "Net send" 'xxx.xxx.xx.xx  - IP address of a system in my network psi.Arguments = "xxx.xxx.xx.xx test" Process.Start(psi)  Thanks in advance! Shwetha Tryu changing   psi.FileName = "Net send" 'xxx.xxx.xx.xx  - IP address of a system in my network psi.Arguments = "xxx.xxx.xx.xx test&quo...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0 #2
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! There are too many differences for one email - - from 1.0 to 1.1 (not a whole lot of real change, other than fixes, at least compared to 1.1 to 2.0) With 2.0, there were many new declarative controls, with many new ideas added in With 3.0, it's a superset of 2.0 - instead of replacing the installation completely, it just 'added on' new functionality - I would...

Rotate images? (geometric rotation not "ad rotation" )
I want to allow the user to rotate an image by any increment..not just 90 degrees. Is this doable? I think you should be able to do this by using the Graphics.RotateTransform method. Website Design Darlington - http://mdssolutions.co.ukhttp://lessthandot.com - Experts, Information, Ideas & Knowledgehttp://aspnetlibrary.com - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer" on this post if it helped you...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

Rotate bitmap image by 30 degrees
 Hi,I know you can do: bmp.RotateFlip(RotateFlipType.Rotate180FlipNone)but how can you do:bmp.RotateFlip(RotateFlipType.Rotate30FlipNone) Thanks,Curt. Regards, Curt  use RotateTransform method of the graphics object.  hope this helps The real voyage of discovery consists not in making new landscapes, but in having new eyes Ive done the following but its not worked :SDim BackgroundBmpG As Graphics = Graphics.FromImage(BackgroundBmp)BackgroundBmpG.RotateTransform(30) any ideas?Thanks,CurtRegards, Curt...

Web resources about - bitmap rotation - asp.net.drawinggdi

Rotation - Wikipedia, the free encyclopedia
A rotation is a circular movement of an object around a center (or point ) of rotation . A three-dimensional object always rotates around an ...

The Great Venture Capital Rotation
A couple of years ago, I was chatting with a guy named Naval, who had a site called AngelList. He had a fiery passion for helping founders and ...

Rotation for iPhone, iPod touch, and iPad on the iTunes App Store
Get Rotation on the App Store. See screenshots and ratings, and read customer reviews.

José Diaz-Balart Part of Anchor Rotation for Nightly News Saturday
Telemundo and MSNBC anchor José Diaz-Balart has been added to the rotation of anchors for the NBC Nightly News Saturday editions. He’ll also ...

Revisiting Carlos Martinez's rotation conversion
Before the season, the odds were against Martinez increasing his strikeout rate while moving to the rotation. He did it anyway. At the beginning ...

Joakim Noah could wind up in reserve role as Bulls sort out their rotation
... incomplete rosters during the Bulls preseason, coach Fred Hoiberg has been consistent about one thing: Establishing his starting five and rotation ...

Minor injuries in preseason give Rockets’ rotation guys a chance to play together
The Rockets injuries forced them to go without starters Dwight Howard (back), James Harden (knee) and Ty Lawson (back) on Sunday, with Marcus ...

Kings notes: Rotation taking shape; dealing with officiating
The Kings wrapped up Day 3 of NBA training camp, looking to brand a new season in 2015-16. Insider James Ham brings you key takeaways from Sac-Town... ...

The Bizarre Reason Earth's Rotation Will Slow Down This Century
... of depressing predictions for the future, here’s one that is both fascinating and as innocuous as they come: as ice caps melt, Earth’s rotation ...

New York Mets set rotation for NLDS, to start Jacob deGrom in Game 1
The New York Mets have set their rotation for the division series against the Los Angeles Dodgers and will give the ball to Jacob deGrom in Game ...

Resources last updated: 12/12/2015 11:17:16 PM