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

Notification

Icon
Error

Options
Go to last post Go to first unread
Crimblepud  
#1 Posted : Thursday, June 8, 2006 11:41:39 PM(UTC)
Crimblepud

Rank: Member

Groups: Member
Joined: 5/23/2006(UTC)
Posts: 11

Hi, I have included a bit of code below - it's a bit longwinded and I have cut some bits out but it still reproduces the effect I am enquiring about. The gist of it is that I am trying to set the background colour to white and make it transparent. 1) The transparency works fine in a web page, but when I load the resulting GIF into Photoshop, in is not showing as transparent, like transparent gifs that I have created using Photoshop (e.g. with the grey/white checkered background). 2) The actual background colour is coming out as 254, 254, 254 rather than 255, 255, 255 (web rgb colour values). If anyone can suggest wher4e I might be going wrong in the code, I would be very grateful. Thanks, John Campbell ASP CODE BELOW:
Code:
 " " Then
				' * See note 1 below:
				pos =  4 + arrPositions(i) + .TextFormat.Abc(CurrentChar, 0) - (i * 1) + 3
				.DrawArtisticText CurrentChar, pos, 6, true, false
			End If
		Next 'i
	End With
	
	' Draw the background text...
	With objBitmapBackground.Graphics 
		.Engine = DrawingEngineGdiplus
		.Antialiasing = true
		.Unit = UnitPixel
		.TextFormat.FontName = pStrFontName
		.TextFormat.FontColor = .Color.CreateRGB(211, 209, 233)
		.TextFormat.FontSize = FONT_SIZE
		.TextFormat.IsBold = true
		.Brush.PrimaryColor = .Color.CreateRGB(211, 209, 233)
		.Pen.ForeColor = .Color.CreateRGB(211, 209, 233)
		.Pen.Weight = 3
		For i = LBound(arrPositions) To UBound(arrPositions)
			CurrentChar = Mid(pStrText, i + 1, 1)
			If CurrentChar " " Then
				' * See note 1 above:
				pos = 4 + arrPositions(i) + .TextFormat.Abc(CurrentChar, 0) - (i * 1)
				.DrawArtisticText CurrentChar, pos, 0, true, true
			End If
		Next 'i
		intActualWidth = pos + intLastCharWidth
	End With
	
	' Apply glow effect on text...
	objBitmapBackground.ArtisticEffects.Glow objBitmapBackground.Graphics.Color.CreateRGB(211, 209, 233), 5, false
	objBitmapForeground.ArtisticEffects.Glow objBitmapForeground.Graphics.Color.CreateRGB(209, 207, 231), 5, false
	
	' Draw foreground image onto background with transparency
	objBitmapForeground.DrawOnBitmap objBitmapBackground, , , , , , , , , CombineModeAlpha, 255
	
	' Crop to remove excess whitespace...
	objBitmapBackground.Transforms.Crop 10, 10, pIntPicWidth - 20, pIntPicHeight - 20, &h00FFFFFF

	objBitmapBackground.DrawOnBitmap objBitmapActual
	
	' Reduce Colour depth...
	objBitmapActual.Data.ConvertTo24bppRgb True,  &h00FFFFFF
	' Set image format...
	objBitmapActual.Formats.SelectCurrent "GIF"
	' Set no dithering...
	objBitmapActual.Data.ConvertTo8bppIndexed DitheringTypeNone, , , , 255

	' Make color &h00FFFFFF full transparent...
	objBitmapActual.Data.Palette.SetTransparentColor &h00FFFFFF
	' Set transparancy & LZW enabled...
	objBitmapActual.Formats.GifIsTransparent = true
	objBitmapActual.IsLzwEnabled = true

	objBitmapActual.SaveToStream Response
	
	Set objBitmapActual = Nothing
	Set objBitmapBackground = Nothing
	Set objBitmapForeground = Nothing

	GenerateTextBanner = true
End Function 'GenerateTextBanner(ByVal pStrSavePath, ByVal pStrText, ByVal pStrFontName, ByVal pIntPicWidth, ByVal pIntPicHeigh)


Call GenerateTextBanner("", "Expression", "Tahoma", 480, 100)

Edited by user Wednesday, December 19, 2007 4:24:25 PM(UTC)  | Reason: Not specified

Andrew  
#2 Posted : Monday, June 12, 2006 9:57:08 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 866

Thanks: 2 times
Was thanked: 26 time(s) in 26 post(s)
Most likely there is no pure white color in the result image. By default the adaptive palette is used during conversion that makes colors dynamically (rather than fixed set of colors). If you want to have a web-safe palette, you can specify it in the ConvertTo8bppIndexed method. See this method reference in documentaion for more details.
Users browsing this topic
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.