diff options
author | Teravus Ovares | 2008-06-17 00:55:30 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-06-17 00:55:30 +0000 |
commit | a401b03ab0cdfb2e98d36e290255e730870890a1 (patch) | |
tree | 01331d307365a24618d40c011b06d8e79bf0a12c /OpenSim/Region | |
parent | * Fix a bug in the archiver where I didn't realize a shape still needs its de... (diff) | |
download | opensim-SC_OLD-a401b03ab0cdfb2e98d36e290255e730870890a1.zip opensim-SC_OLD-a401b03ab0cdfb2e98d36e290255e730870890a1.tar.gz opensim-SC_OLD-a401b03ab0cdfb2e98d36e290255e730870890a1.tar.bz2 opensim-SC_OLD-a401b03ab0cdfb2e98d36e290255e730870890a1.tar.xz |
* Increase WEBMAP tile jpeg quality.
* I'm not sure if this method works on Linux.. but I guess I'll find out :P
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs | 30 |
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 | } |