Results 1 to 6 of 6

Thread: High Quallity Image Resizing in Medium Trust?

  1. #1
    Join Date
    Nov 2005
    Location
    West Midlands
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default High Quallity Image Resizing in Medium Trust?

    I need to be able to dynamically resize images prior to rendering them. I've found a couple of solutions, but they all fail to work in medium true due to unmanaged/unsafe code (namely the OctreeQuantizer). http://www.glennjones.net/Post/799/H...geswithnet.htm is one such example.

    Is there a .Net 2.0 component (free or chargeable) that I can just plug into my ASP.Net site to do this?

    Alternatively, has anyone managed to get (high quality) image resizing working with their medium trust, RedFox hosted site? Does anyone have any C# 2.0 code to do this?
    Leigh

  2. #2
    Join Date
    Feb 2004
    Posts
    4,903
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    Cant you use GDI (System.Drawing namespace) under Medium Trust? Heres what I used in a recent project:

    Code:
        Public Shared Sub ResizeImage(ByRef image As Bitmap, ByVal width As Integer, ByVal height As Integer, Optional ByVal antiAlias As Boolean = False)
            Dim NewImage As New Bitmap(width, height)
            Dim Graphics As Graphics = Drawing.Graphics.FromImage(NewImage)
            If antiAlias Then Graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBilinear
            Graphics.DrawImage(image, 0, 0, width, height)
            image = NewImage
        End Sub
    ...set the antiAlias boolean for high quality resizing.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

  3. #3
    Join Date
    Feb 2004
    Posts
    4,903
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    Sorry, should have read the link you posted - even so using HighQualityBilinear I couldnt complain with the resize quality.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

  4. #4
    Join Date
    Oct 2005
    Location
    Scotland
    Posts
    229
    Thanks
    7
    Thanked 12 Times in 8 Posts

    Default

    What type of images are you going to be resizing. If it's images with text on them as an eps or gif which GDI+ can also do maybe your best option to keep the text sharp.

    I output my images as eps's on comedyquotes.net as they are mainly text based.

    If it has to be JPEG you can adjust the quality/compression of the JPEG from within your code.

    I use JPEG output on igapyear.com as they are mainly pictures without text.

  5. #5
    Join Date
    Nov 2005
    Location
    West Midlands
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks guys. I'm currently using Warren's code, although this looks promising: http://www.waterwijkers.nl/bip/

    Cheers
    Leigh

  6. #6
    Join Date
    Feb 2004
    Posts
    4,903
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    Quote Originally Posted by Leigh View Post
    Thanks guys. I'm currently using Warren's code, although this looks promising: http://www.waterwijkers.nl/bip/

    Cheers
    Nice to see .NET code that understands Medium Trust
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. High Trust Level Memberships
    By marcusmonaghan in forum ASP.NET
    Replies: 12
    Last Post: 24th June 2006, 09:36 PM
  2. Replies: 1
    Last Post: 20th March 2006, 03:02 PM
  3. AJAX and Trust Level
    By Gabriel Martins in forum ASP.NET
    Replies: 18
    Last Post: 27th February 2006, 10:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •