Ask a Question related to ASP.NET General, Design and Development.
-
James A Taber #1
GDI+ Resizing image problem
Problem resizing image.(JPG)
If i try to resize an img with horisontal=150 and vertical resolution=150
The quality of the target image is dramatically reduced. Source code is
provided below.
How can i solve this? What am i doing wrong?
Thanx in advance
-James A Taber
Public Sub ResizeImage(ByVal sSourcePath As String, ByVal sTargetPath As
String)
Dim fs As FileStream
Dim gImageIn As Image
Dim gImageInFormat As Object
Try
fs = New FileStream(sSourcePath, FileMode.Open, FileAccess.Read)
gImageIn = Image.FromStream(fs)
gImageInFormat = gImageIn.RawFormat
Dim gImageOut As New System.Drawing.Bitmap(gImageIn, 350, 262)
gImageOut.Save(sTargetPath, gImageInFormat)
Catch
Throw
Finally
fs.Close()
gImageIn.Dispose()
End Try
End Sub
James A Taber Guest
-
Image Resizing With A Catch
So I'm running ColdFusion on GoDaddy Linux Hosting (booo, I know, but it's cheap and I'm a poor college student that likes to have lots of domains).... -
image resizing
Hi, Is there a toggle switch in InDesign which enables one to resize an image using the pick tool without cropping it? -Paul -
Resizing a image!
Hello, I just started with PHP. And I have made a code for uploading images. Now I wil resize the image also to a tumbnail, but when I search... -
Resizing an image...
I have a jpg that when clicked upon opens to about 4 x 6 on screen. How can I resize this photo so that the maximum it will only open to is a 3" x 4"... -
Resizing high res image smaller results in blurred image
Hi there, I have a high res logo in PSD format (around 1500px x 1500px) but when I resize it to around 300px x 300px the resulting image is not... -
PJ #2
Re: GDI+ Resizing image problem
ahh...I have a method at work to create quality thumbnails, but I am at
home...
here is a discussion to help you get started...it's where i did...
[url]http://www.dotnet247.com/247reference/msgs/25/128742.aspx[/url]
"James A Taber" <icecool_6@hotmail.com> wrote in message
news:eB7LHhuODHA.4024@tk2msftngp13.phx.gbl...FileAccess.Read)> Problem resizing image.(JPG)
>
> If i try to resize an img with horisontal=150 and vertical resolution=150
> The quality of the target image is dramatically reduced. Source code is
> provided below.
>
> How can i solve this? What am i doing wrong?
>
> Thanx in advance
> -James A Taber
>
> Public Sub ResizeImage(ByVal sSourcePath As String, ByVal sTargetPath As
> String)
> Dim fs As FileStream
> Dim gImageIn As Image
> Dim gImageInFormat As Object
>
> Try
> fs = New FileStream(sSourcePath, FileMode.Open,> gImageIn = Image.FromStream(fs)
>
> gImageInFormat = gImageIn.RawFormat
> Dim gImageOut As New System.Drawing.Bitmap(gImageIn, 350, 262)
>
> gImageOut.Save(sTargetPath, gImageInFormat)
>
> Catch
> Throw
> Finally
> fs.Close()
> gImageIn.Dispose()
> End Try
>
> End Sub
>
>
PJ Guest
-
Natty Gur #3
Re: GDI+ Resizing image problem
Hi,
use :
oGrapic.InterpolationMode =
System.Drawing.Drawing2D.InterpolationMode.HighQua lityBilinear
oGrapic.DrawImage(oBmp, New Rectangle(0, 0, oTxtBmp.Width,
oTxtBmp.Height), _
0, _
0, _
oBmp.Width, _
oBmp.Height, _
GraphicsUnit.Pixel)
you can also refer to this sample[1] that create dynamic buttons by the
button text length.
[1] [url]http://www.developersdex.com/gurus/code/599.asp[/url]
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
James A Taber #4
Re: GDI+ Resizing image problem
I have tried to figue it out ... But have until now not been able to do
that. Could you provide me some sample code?
I would be greatful for any help.
Thanx
James A Taber
"PJ" <pjwalNOSPAM@hotmail.com> wrote in message
news:O3234muODHA.1072@TK2MSFTNGP10.phx.gbl...resolution=150> ahh...I have a method at work to create quality thumbnails, but I am at
> home...
>
> here is a discussion to help you get started...it's where i did...
> [url]http://www.dotnet247.com/247reference/msgs/25/128742.aspx[/url]
>
> "James A Taber" <icecool_6@hotmail.com> wrote in message
> news:eB7LHhuODHA.4024@tk2msftngp13.phx.gbl...> > Problem resizing image.(JPG)
> >
> > If i try to resize an img with horisontal=150 and vertical262)> FileAccess.Read)> > The quality of the target image is dramatically reduced. Source code is
> > provided below.
> >
> > How can i solve this? What am i doing wrong?
> >
> > Thanx in advance
> > -James A Taber
> >
> > Public Sub ResizeImage(ByVal sSourcePath As String, ByVal sTargetPath As
> > String)
> > Dim fs As FileStream
> > Dim gImageIn As Image
> > Dim gImageInFormat As Object
> >
> > Try
> > fs = New FileStream(sSourcePath, FileMode.Open,> > gImageIn = Image.FromStream(fs)
> >
> > gImageInFormat = gImageIn.RawFormat
> > Dim gImageOut As New System.Drawing.Bitmap(gImageIn, 350,>> >
> > gImageOut.Save(sTargetPath, gImageInFormat)
> >
> > Catch
> > Throw
> > Finally
> > fs.Close()
> > gImageIn.Dispose()
> > End Try
> >
> > End Sub
> >
> >
>
James A Taber Guest
-
James A Taber #5
Re: GDI+ Resizing image problem
Tank you, This is absolutely perfect!
Thanks for all you help and time.
:-)
James A Taber
"PJ" <pjwal@hotmail.com> wrote in message
news:e9nHaF3ODHA.2460@TK2MSFTNGP10.phx.gbl...awful> here's a method i use...sorry it's VB...i'm forced to code in this godSize)> syntax right now...
>
> Private Shared Function ScaleFile(ByVal img As Image, ByVal newSize Asat> As Byte()
>
> Dim newImg As Image = New Bitmap(newSize.Width, newSize.Height,
> img.PixelFormat)
> Dim graphic As Graphics = Graphics.FromImage(newImg)
> graphic.CompositingQuality() =
> Drawing.Drawing2D.CompositingQuality.HighQuality
> graphic.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality
> graphic.InterpolationMode =
> Drawing.Drawing2D.InterpolationMode.HighQualityBic ubic
> Dim rect As New Rectangle(0, 0, newSize.Width, newSize.Height)
> graphic.DrawImage(img, rect)
> Dim ms As New MemoryStream()
> newImg.Save(ms, img.RawFormat)
> Dim bytes As Byte() = ms.ToArray()
> ms.Close()
> Return bytes
>
> End Function
>
> "James A Taber" <icecool_6@hotmail.com> wrote in message
> news:uEMVn1wODHA.1608@TK2MSFTNGP11.phx.gbl...> > I have tried to figue it out ... But have until now not been able to do
> > that. Could you provide me some sample code?
> >
> > I would be greatful for any help.
> >
> > Thanx
> >
> > James A Taber
> >
> >
> >
> > "PJ" <pjwalNOSPAM@hotmail.com> wrote in message
> > news:O3234muODHA.1072@TK2MSFTNGP10.phx.gbl...> > > ahh...I have a method at work to create quality thumbnails, but I amsTargetPath> is> > resolution=150> > > home...
> > >
> > > here is a discussion to help you get started...it's where i did...
> > > [url]http://www.dotnet247.com/247reference/msgs/25/128742.aspx[/url]
> > >
> > > "James A Taber" <icecool_6@hotmail.com> wrote in message
> > > news:eB7LHhuODHA.4024@tk2msftngp13.phx.gbl...
> > > > Problem resizing image.(JPG)
> > > >
> > > > If i try to resize an img with horisontal=150 and vertical> > > > The quality of the target image is dramatically reduced. Source code> > > > provided below.
> > > >
> > > > How can i solve this? What am i doing wrong?
> > > >
> > > > Thanx in advance
> > > > -James A Taber
> > > >
> > > > Public Sub ResizeImage(ByVal sSourcePath As String, ByVal350,> As> > > > String)
> > > > Dim fs As FileStream
> > > > Dim gImageIn As Image
> > > > Dim gImageInFormat As Object
> > > >
> > > > Try
> > > > fs = New FileStream(sSourcePath, FileMode.Open,
> > > FileAccess.Read)
> > > > gImageIn = Image.FromStream(fs)
> > > >
> > > > gImageInFormat = gImageIn.RawFormat
> > > > Dim gImageOut As New System.Drawing.Bitmap(gImageIn,>> > 262)> >> > > >
> > > > gImageOut.Save(sTargetPath, gImageInFormat)
> > > >
> > > > Catch
> > > > Throw
> > > > Finally
> > > > fs.Close()
> > > > gImageIn.Dispose()
> > > > End Try
> > > >
> > > > End Sub
> > > >
> > > >
> > >
> > >
> >
>
James A Taber Guest



Reply With Quote

