From 84235900b284e7377b802a626f64edaaec39159a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 15:13:21 +0100 Subject: [PATCH] do not use lossless compression on dyntextures --- .../DynamicTexture/DynamicTextureModule.cs | 2 +- .../LoadImageURL/LoadImageURLModule.cs | 73 ++++++++++--------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 090cb7d447..00c46826de 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture try { - result = OpenJPEG.EncodeFromImage(joint, true); + result = OpenJPEG.EncodeFromImage(joint, false); } catch (Exception e) { diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 673a453e75..e7927464b3 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -215,43 +215,44 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL { try { - Bitmap image = new Bitmap(stream); + using(Bitmap image = new Bitmap(stream)) + { + // TODO: make this a bit less hard coded + if((image.Height < 64) && (image.Width < 64)) + { + newSize.Width = 32; + newSize.Height = 32; + } + else if((image.Height < 128) && (image.Width < 128)) + { + newSize.Width = 64; + newSize.Height = 64; + } + else if((image.Height < 256) && (image.Width < 256)) + { + newSize.Width = 128; + newSize.Height = 128; + } + else if((image.Height < 512 && image.Width < 512)) + { + newSize.Width = 256; + newSize.Height = 256; + } + else if((image.Height < 1024 && image.Width < 1024)) + { + newSize.Width = 512; + newSize.Height = 512; + } + else + { + newSize.Width = 1024; + newSize.Height = 1024; + } - // TODO: make this a bit less hard coded - if ((image.Height < 64) && (image.Width < 64)) - { - newSize.Width = 32; - newSize.Height = 32; - } - else if ((image.Height < 128) && (image.Width < 128)) - { - newSize.Width = 64; - newSize.Height = 64; - } - else if ((image.Height < 256) && (image.Width < 256)) - { - newSize.Width = 128; - newSize.Height = 128; - } - else if ((image.Height < 512 && image.Width < 512)) - { - newSize.Width = 256; - newSize.Height = 256; - } - else if ((image.Height < 1024 && image.Width < 1024)) - { - newSize.Width = 512; - newSize.Height = 512; - } - else - { - newSize.Width = 1024; - newSize.Height = 1024; - } - - using (Bitmap resize = new Bitmap(image, newSize)) - { - imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); + using(Bitmap resize = new Bitmap(image, newSize)) + { + imageJ2000 = OpenJPEG.EncodeFromImage(resize, false); + } } } catch (Exception)