I want to resize the image using C#. But the Image class is not working on larger Images. So I chose to use Aspose.Imaging as it is mentioned that it supports larger files. But it shows the same exception when i try to upload larger Images.
Below is my code:
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(filePath))
{
image.Resize(300, 300);
image.Save();
}
Kindly advice me if anyone knows about Aspose.Imaging for Dotnet
Hi Sam,
Hi,
Thank you for the speedy reply. Below are the requested details
I have attached sample at Dropbox - Error - Simplify your life
Exception occurring is: Cannot allocate image in memory. Image size exceeds memory size
Stack trace for this sample attached:
at . (Rectangle )
at .LoadRawData(Rectangle , RawDataSettings , IPartialRawDataLoader )
at .LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.. (Rectangle )
at .(Rectangle , , , Int32 , Int32 )
at .(Rectangle , )
at Aspose.Imaging.RasterImage.LoadPixelsInternal(Rectangle rectangle, IPartialArgb32PixelLoader pixelLoader)
at Aspose.Imaging.RasterImage.(Rectangle , Int32[] , Boolean , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.(Rectangle , Boolean , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels(Rectangle desiredRectangle, IPartialArgb32PixelLoader pixelLoader)
at .(RasterCachedImage , Int32 , Int32 , ResizeType )
at Aspose.Imaging.RasterCachedImage.Resize(Int32 newWidth, Int32 newHeight, ResizeType resizeType)
at Aspose.Imaging.Image.Resize(Int32 newWidth, Int32 newHeight)
at Aspose_Sample.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Users\samazpan.d\Desktop\Aspose Sample\Aspose Sample\WebForm1.aspx.cs:line 20
Hi Sam,
Thank you for taking this issue forward. Waiting for your update on this.
Hi Sam,
Thank you for your perusal Babar. Eagerly waiting for your response…
Hi Sam,
Aspose.Imaging.Cache.CacheFolder = @“D:\temp”;
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(filePath))
{
image.Resize(300, 300);
image.Save();
}
Hi Babar,
Thank you Barbar for this issue is in queue.
I checked both by disabling and enabling cache in console application. It shows same exception in both case at Image.Resize…
Thanks,
Sam Azpan
Hi Sam,
Hi Babar,
I have 8GB RAM.
This is an exception: Cannot allocate image in memory. Image size exceeds memory size
Exception details:
Aspose.Imaging.Exceptions.FrameworkException was unhandled
HResult=-2146233088
Message=Cannot allocate image in memory. Image size exceeds memory size
Source=Aspose.Imaging
StackTrace:
at . (Rectangle )
at .LoadRawData(Rectangle , RawDataSettings , IPartialRawDataLoader )
at .LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.. (Rectangle )
at .(Rectangle , , , Int32 , Int32 )
at .(Rectangle , )
at Aspose.Imaging.RasterImage.LoadPixelsInternal(Rectangle rectangle, IPartialArgb32PixelLoader pixelLoader)
at Aspose.Imaging.RasterImage.(Rectangle , Int32[] , Boolean , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.(Rectangle , Boolean , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels(Rectangle desiredRectangle, IPartialArgb32PixelLoader pixelLoader)
at .(RasterCachedImage , Int32 , Int32 , ResizeType )
at Aspose.Imaging.RasterCachedImage.Resize(Int32 newWidth, Int32 newHeight, ResizeType resizeType)
at Aspose.Imaging.Image.Resize(Int32 newWidth, Int32 newHeight)
at AsposeCheck.Program.check() in C:\Users\samazpan.d\Desktop\Asked by Aspose\AsposeCheck\AsposeCheck\Program.cs:line 24
at AsposeCheck.Program.Main(String[] args) in C:\Users\samazpan.d\Desktop\Asked by Aspose\AsposeCheck\AsposeCheck\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.OutOfMemoryException
HResult=-2147024882
Message=Insufficient memory to continue the execution of the program.
InnerException:
Thank you,
Sam
Hi Sam,
Hi again,
Ok…Thank you.
The issues you have found earlier (filed as IMAGING-34875) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
The issues you have found earlier (filed as IMAGING-34879) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.