Det beror lite på vad ditt problem är egentligen. Endera tänker du på kvaliten för hur mycket jpg ska komprimeras eller så tänker du på kvaliten på algorithmen som förminskar bilden.
För att pilla på kvalitén (vb.net exempel...sorry!):
Kod:
Const intQuality=25
dim bmpBitmap1 as New Bitmap(server.mappath("images/alima.jpg"))
'Get the list of available encoders
Dim codecs() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders()
'find the encoder with the image/jpeg mime-type
dim iciInfo as ImageCodecInfo
dim item as ImageCodecInfo
for each item in codecs
*if(item.MimeType="image/jpeg")then iciInfo=item
next
'Create a collection of encoder parameters (we only need one in the collection)
Dim ep as EncoderParameters = new EncoderParameters()
ep.Param(0)= new system.drawing.imaging.EncoderParameter(system.drawing.imaging.Encoder.Quality,intQuality)
'Set the content type
response.contenttype="image/jpeg"
'bmpBitmap1.save(server.mappath("." & "/article_images/alima25.jpg"), iciInfo, ep)
'send the bitmap to the outputstream
bmpBitmap1.save(response.outputstream, iciInfo, ep)
'tidy up
bmpBitmap1.dispose()
..om det gäller algorithmen för att skala om den så vet jag inte hur man gör...