Jpeg quality not working...

Nov 9, 2010 at 7:49 PM

Hi, nice library. I'm testing it in a Silverlight 4 application. I'm saving an image to isolated storage, and trying to encode it in Jpeg. Changing quality to 70, 30 or 0 gives the same file size. Opening the file with Paint in windows 7 and save it as jpeg gives a size of 68K compared to 431K of ImageTools. Here is the code to save:

	' I think these two lines are not needed, I tested with and without them
        ImageTools.IO.Decoders.AddDecoder(Of ImageTools.IO.Jpeg.JpegDecoder)()
        ImageTools.IO.Encoders.AddEncoder(Of ImageTools.IO.Jpeg.JpegEncoder)()

        Dim img As ImageTools.ExtendedImage = ImageTools.ImageExtensions.ToImage(Me._Photo)

        Dim isf As IO.IsolatedStorage.IsolatedStorageFile = IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication()

        Dim fs As New IO.IsolatedStorage.IsolatedStorageFileStream("test21.jpg", IO.FileMode.OpenOrCreate, isf)

	' This saves in PNG
        'ImageTools.ImageExtensions.WriteToStream(img, fs)
	' I tested the png encoder I can see png format, size is the same as jpeg
        'Dim enc As New ImageTools.IO.Png.PngEncoder

	' it's saved in jpeg, no size change no matters to waht value quality is set
        Dim enc As New ImageTools.IO.Jpeg.JpegEncoder
        enc.Quality = 30

        enc.Encode(img, fs)

I tested as I state in comments. Used PNG encoder, the size is equal to Jpeg encoder. Quality doesn't make a difference in size. Any clues??

Thanks in advance,