aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
index 1dc0d0b..c8d2ef6 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs
@@ -279,8 +279,22 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
279 // Save to bitmap 279 // Save to bitmap
280 mapTexture = new Bitmap(image); 280 mapTexture = new Bitmap(image);
281 281
282 ImageCodecInfo myImageCodecInfo;
283
284 Encoder myEncoder;
285
286 EncoderParameter myEncoderParameter;
287 EncoderParameters myEncoderParameters = new EncoderParameters();
288
289 myImageCodecInfo = GetEncoderInfo("image/jpeg");
290
291 myEncoder = Encoder.Quality;
292
293 myEncoderParameter = new EncoderParameter(myEncoder, 95L);
294 myEncoderParameters.Param[0] = myEncoderParameter;
295
282 // Save bitmap to stream 296 // Save bitmap to stream
283 mapTexture.Save(imgstream, ImageFormat.Jpeg); 297 mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters);
284 298
285 // Write the stream to a byte array for output 299 // Write the stream to a byte array for output
286 jpeg = imgstream.ToArray(); 300 jpeg = imgstream.ToArray();
@@ -314,5 +328,19 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
314 328
315 return reply; 329 return reply;
316 } 330 }
331 // From msdn
332 private static ImageCodecInfo GetEncoderInfo(String mimeType)
333 {
334 int j;
335 ImageCodecInfo[] encoders;
336 encoders = ImageCodecInfo.GetImageEncoders();
337 for (j = 0; j < encoders.Length; ++j)
338 {
339 if (encoders[j].MimeType == mimeType)
340 return encoders[j];
341 }
342 return null;
343 }
344
317 } 345 }
318} 346}