Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ark2  
#1 Posted : Friday, February 1, 2008 2:12:06 PM(UTC)
ark2

Rank: Member

Groups: Member
Joined: 7/5/2005(UTC)
Posts: 9

Hello,

With Andrew's help I was able to setup an asp script to perform colorization of greyscale images by using a color passed to the function, however the limitation there is the mill for activex I think does not allow me to have the function also use the passed color's brightness value... or something like that... below is the script I use, can someone tell me if this can be done better with the mill for .net?

also, could someone develop a com component to do this single function for me that I could use from asp that would call mill .net and save the new image to disk?

since this is done once it doesn't have to be super scalable or anything...

I have a budget for this...

here is my current .asp code:

Code:
QUERY_STRING = Request.ServerVariables("QUERY_STRING") :QUERY_STRING = replace(QUERY_STRING,"404;","") :QUERY_STRING = replace(QUERY_STRING,":80","") :QUERY_STRINGl = lcase(QUERY_STRING)

strtmpp = split(QUERY_STRING,"/")
upper = ubound(strtmpp)
strtmpp2 = split(strtmpp(upper),"-")
iconstr = replace(strtmpp(upper),strtmpp2(0) & "-","")
color = strtmpp2(0)
filename = "c:\inetpub\wwwroot\library\html.templates\2\images\" & iconstr
filename2 = "c:\inetpub\wwwroot\library\html.templates\2\images\" & strtmpp2(0) & "-" & iconstr
'response.write iconstr & "<br>"
'response.write color & "<br>"
'response.write filename & "<br>"
'response.write filename2 & "<br>"
'response.end
Dim objFaceBitmap
Set objFaceBitmap = Server.CreateObject("GraphicsMill.Bitmap")

Dim objCol
Set objCol = Server.CreateObject("GraphicsMill.Color")
Dim objPalBitmap
Set objPalBitmap = Server.CreateObject("GraphicsMill.Bitmap")
objFaceBitmap.IsLzwEnabled = True
objFaceBitmap.LoadFromFile filename

If Not objFaceBitmap.Data.IsIndexed Then objFaceBitmap.Data.ConvertTo8bppIndexed
 
'inputColor1 = &HFFFF0000
Execute "inputColor1 = &hFF" & replace(color,"#","")
objPalBitmap.CreateNew objFaceBitmap.Data.Palette.Count, 1, Format24bppRgb
For I = 0 To objFaceBitmap.Data.Palette.Count - 1
    objPalBitmap.Data.Pixels(I, 0) = objFaceBitmap.Data.Palette(I)
Next
objPalBitmap.ColorAdjustment.Desaturate
objPalBitmap.ColorAdjustment.AdjustHsl objCol.GetHue(inputColor1), objCol.GetSaturation(inputColor1), 0

For I = 0 To objFaceBitmap.Data.Palette.Count - 1
    objFaceBitmap.Data.Palette(I) = objPalBitmap.Data.Pixels(I, 0)
Next


	response.Status = "200 OK"

			if instr(iconstr,".png") > 0 then
			response.ContentType = "image/png"
			elseif instr(iconstr,".gif") > 0 then
			response.ContentType = "image/gif"
			elseif instr(iconstr,".jpg") > 0 then
			response.ContentType = "image/jpeg"
			end if


objFaceBitmap.SaveToFile filename2
objFaceBitmap.SaveToStream Response
response.end
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.