I följande tråd kan du läsa om hur JPG-kompression kan sättas:
http://www.webforum.nu/showthread.php?s=&forumid=29&threadid=79164&highlight=jpg
2 svar · 417 visningar · startad av m-blo
Använder koden nedan för att skicka ett värde i en querystring och sedan skapa en bild med just det värdet (texten) i... Problemet är att jag vill byta GIF-format... Jag vill byta färgformatet till "Optimized Octree"... Går det att ändra format? Alternativt , går det att ändra kompressionen om man använder JPG istället?
<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim objFont As System.Drawing.Font
' Create new image - bitmap
objBMP = New Bitmap(250, 30)
' Create a graphics object to work with from the BMP
objGraphics = System.Drawing.Graphics.FromImage(objBMP)
' Fill the image with background color
objGraphics.Clear(Color.White)
' Set anti-aliasing for text to make it better looking
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias
' Configure font to use for text
objFont = New Font("Verdana", 8, FontStyle.Bold)
' Write out the text
objGraphics.DrawString(Request.QueryString("text"), objFont, Brushes.Black, 3, 3)
' Set the content type and return the image
Response.ContentType = "image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)
' Kill our objects
objFont.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%>
I följande tråd kan du läsa om hur JPG-kompression kan sättas:
http://www.webforum.nu/showthread.php?s=&forumid=29&threadid=79164&highlight=jpg
Tack.