Wrox Programmer Forums
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 11th, 2004, 01:40 PM
Authorized User
Join Date: Aug 2003
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default GDI+ - Issue Resizing images

Help! I created a program that draws/creates barcodes using .NET's GDI+ classes. The result of my method yields a image data type.

My problem is that when I resize the image (which is simple black and white) I get blurring. Its worse, interesting enough, when I scale down. I've tried using the built in getthumbnail function, I've create new bitmaps of a different size and have drawn the contents of the graphics object from my barcode image to it, and I I have tried something similar using a rectangle that is sized to the size of the new image size. I've also set the image quality properties of the graphics object..
    g.SmoothingMode = SmoothingMode.HighQuality
    g.InterpolationMode = InterpolationMode.HighQualityBicubic
    g.PixelOffsetMode = PixelOffsetMode.HighQuality

EVERYTHING blurs the image! Anyone have a solution or something new to try?

Old March 14th, 2004, 08:28 PM
Registered User
Join Date: Mar 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

I don't get any problems with resize and image qulity problem.
When you resize, have you tried for compression values?
These are someImage Resize Functions which i'm using on my current application.
sample url image resized:


code sample (simplified):

        Public Sub SaveImage(ByRef img As Image, ByVal dest As String, ByVal compression As Integer)
            Dim EncoderParams As New EncoderParameters(1)
                EncoderParams.Param(0) = New EncoderParameter(Encoder.Quality, compression)
                img.Save(dest, GetEncoderInfo, EncoderParams)
            Catch ex As Exception
            End Try
            EncoderParams = Nothing
        End Sub

        Private Function GetEncoderInfo() As ImageCodecInfo
            Dim encoderReturn As ImageCodecInfo = Nothing
            Dim encoders As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders
            Dim encoder As ImageCodecInfo
            For Each encoder In encoders
                If encoder.MimeType = "image/jpeg" Then
                    encoderReturn = encoder
                End If
            encoders = Nothing
            Return encoderReturn
        End Function

Old April 16th, 2004, 08:11 PM
Registered User
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Sorry busyweb, I don't really understand how can I use your code.
Could you please tell me where should I do my resize before I save the image? I am trying to shrink the photo from the original size.

Similar Threads
Thread Thread Starter Forum Replies Last Post
uploading/resizing (transparant) images in C# smiter C# 1 February 19th, 2007 08:53 PM
Resizing Images san123 ASP.NET 1.0 and 1.1 Basics 2 April 26th, 2006 02:51 PM
Resizing images according to paper size Taxidriver Crystal Reports 3 March 28th, 2006 06:08 AM
Working with Images Issue Capt D PHP Databases 6 January 31st, 2005 04:49 PM
Resizing Images From a Database mayhew3 Pro PHP 1 March 3rd, 2004 07:19 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.