We have moved to GitHub Issues
Created by Jeavon Leopold 12 Dec 2013, 10:47:07 Updated by wtct 07 Nov 2016, 09:15:39
When uploading a 11Mb image in Umbraco v7.0.1 I get the following exception: Out of memory.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream)
at Umbraco.Web.PropertyEditors.FileUploadPropertyValueEditor.ConvertEditorToDb(ContentPropertyData editorValue, Object currentValue)
1 contentItem) at Umbraco.Web.Editors.MediaController.MapPropertyValues[TPersisted](ContentBaseItemSave1 contentItem)
at Umbraco.Web.Editors.MediaController.PostSave(MediaItemSave contentItem)
at lambda_method(Closure , Object , Object )
How are you uploading the image?
I've tried with a 10.5 mb image on both the upload prop editor and the drag drop way and it seems to work. Will try with a huge one.
Ok, can replicate with a 14mb one, will investigate
TBH, it's probably an issue in 6.2 as well.
It would seem that when an image is rather large and you are scaling it that the setting:
has a large affect on the processing. This is the 'best' interpolation setting and that is what we use which works fine until the images are huge and we get the out of mem exception. Turns out that GDI+ is riddled with out of mem exceptions but almost none of them are actually related to being out of memory. However in this case it might be exceeding the max individual mem stack for this process.
The other three quality params that we use:
SmoothingMode.HighQuality; PixelOffsetMode.HighQuality; CompositingQuality.HighQuality;
probably also play a factor in this but with a 15 mb image leaving those as high quality still works (not sure what would happen if you got really huge though).
So now i'll just detect if your original image is bigger than either 5000px high or wide and if so use the mid level interpolation.
Here's a good interpololation ref: http://msdn.microsoft.com/en-us/library/k0fsyd4e(v=vs.110).aspx
I'm getting similar errors in 7.2.1. The image is 17.4mb and 11608 x 9061.
Might have to run more detection on image sizes and change one of those parameters above. You'll need to open up another issue with steps to reproduce.
We had similar problem in 6.2.6 with jpg like this: 8 MB, 4608x3456, 72 dpi, 24 bits, sRGB. Take a look at attachment.
This image uploaded properly after App Pool recycled.
App Pool before restar was about 1.2 GB but on the server RAM was still available.
Maybe there is any memory leakage?
2016-11-07 09:43:31,593  ERROR umbraco.presentation.umbraco.webservices.MediaUploader - [Thread 192] Error uploading to parent 418612 System.OutOfMemoryException: Out of memory. at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit) at Umbraco.Core.Models.ContentExtensions.GenerateThumbnail(MediaFileSystem fileSystem, Image image, Int32 maxWidthHeight, String extension, String thumbnailFileName, Boolean useFixedDimensions) at Umbraco.Core.Models.ContentExtensions.Resize(MediaFileSystem fileSystem, String path, String extension, Int32 maxWidthHeight, String fileNameAddition, Image originalImage) at Umbraco.Core.Models.ContentExtensions.SetFileOnContent(IContentBase content, String propertyTypeAlias, String name, Stream fileStream) at umbraco.cms.businesslogic.media.UmbracoImageMediaFactory.DoHandleMedia(Media media, PostedMediaFile postedFile, User user) at umbraco.cms.businesslogic.media.UmbracoMediaFactory.HandleMedia(Int32 parentNodeId, PostedMediaFile postedFile, User user) at umbraco.presentation.umbraco.webservices.MediaUploader.ProcessUploadRequest(HttpContext context)
Assignee: Shannon Deminick
Backwards Compatible: True
Affected versions: 7.0.0, 7.0.1
Due in version: 7.0.2