Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3315936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:24:35+00:00 2026-05-17T22:24:35+00:00

I’ve written several hundred lines of image management code in my current application all

  • 0

I’ve written several hundred lines of image management code in my current application all of which seems to work nicely … except that uploaded GIF’s loose their animation somewhere along the line. I’ve traced the problem down to the point at which images are saved to disk (in order to cache them) as displaying them direct from the database (where they’re stored as blobs) they seem fine.

Here’s the code – there’s a bunch of calls to custom objects and functions that I haven’t listed but I don’t believe they’re relevant to the issue – I think it’s somewhere in these two key function:

Private Sub CreateImageFileInCache()
    Dim CMSImage As Cms.DataTransferObjects.Image = My.Application.ManagerFactory.ImageManagerInstance.ById(ImageId)
    If CMSImage IsNot Nothing Then
        SaveMetaInfo(CMSImage)

        Using ms As New IO.MemoryStream(CMSImage.Data)
            Dim expectedSize As New Drawing.Size(Width, Height)
            Using img As System.Drawing.Image = resizeImage(System.Drawing.Bitmap.FromStream(ms), _
                                                            expectedSize, _
                                                            Drawing.Drawing2D.InterpolationMode.HighQualityBicubic, CMSImage.MimeType)
                img.Save(ImageCachePath, GetEncoderInfo(CMSImage.MimeType), GenerateEncodingParameters)
                img.Dispose()
            End Using
        End Using
    End If
End Sub


Private Function resizeImage(ByVal imgToResize As System.Drawing.Image, ByVal size As System.Drawing.Size, ByVal Quality As System.Drawing.Drawing2D.InterpolationMode, ByVal format As String) As System.Drawing.Bitmap
    Dim sourceWidth As Integer = imgToResize.Width
    Dim sourceHeight As Integer = imgToResize.Height
    Dim resizedImage As System.Drawing.Bitmap
    Dim canvas As System.Drawing.Graphics
    Dim calculatedSize As Drawing.Size = Global.Concrete.Base.Web.Controls.ProductImage.calculateNewImageSize(sourceWidth, sourceHeight, size)

    If calculatedSize.Width > imgToResize.Width AndAlso calculatedSize.Height > imgToResize.Height Then
        calculatedSize.Width = imgToResize.Width
        calculatedSize.Height = imgToResize.Height
    End If

    resizedImage = New System.Drawing.Bitmap(calculatedSize.Width, calculatedSize.Height)
    canvas = System.Drawing.Graphics.FromImage(resizedImage)
    canvas.InterpolationMode = Quality

    If Quality = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic Then
        canvas.CompositingQuality = Drawing.Drawing2D.CompositingQuality.AssumeLinear
        canvas.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
    End If
    canvas.DrawImage(imgToResize, 0, 0, calculatedSize.Width, calculatedSize.Height)
    canvas.Dispose()
    imgToResize.Dispose()

    If format.Contains("gif") Then
        Dim quantizer As Concrete.Cms.ImageManipulation.OctreeQuantizer
        quantizer = New Concrete.Cms.ImageManipulation.OctreeQuantizer(255, 8)
        resizedImage = quantizer.Quantize(resizedImage)
    End If

    Return resizedImage
End Function

Any suggestions gratefully received.

EDIT: Substituting img.Save(ImageCachePath, GetFormat(MimeType)) for the three-argument call to .Save still results in a static gif.

EDIT 2: Actually doing almost anything to a GIF seems to stop it animating! Trying to resize it using Canvas, and trying to presever quality using Quantizing all seem to screw up the animations.

Cheers,
Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:24:36+00:00Added an answer on May 17, 2026 at 10:24 pm

    OK, as far as I can make out THIS IS NOT CURRENTLY POSSIBLE. At least not with any reasonable amount of effort. It does look like it might be possible by using the resizing methods on WPF, but sadly WPF is meant for winforms rather than ASP and rendering looks like a nightmare – potential to solve it by using an Ajax updatepanel and refreshing the content for every frame of the animation as it loads. No thanks!

    I find it amazing that you can’t mess with an animated image at all without loosing the animation information, especially in a technology this mature!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.