mesale0077 14 Posted September 23, 2010 The only color of the background of the pictures, how do I delete the background color thank you help bmp file ,gif file ,jpg file ,background color delete out file ,gif or png file make? Share this post Link to post Share on other sites
JoHanatCent 13 Posted September 23, 2010 Did you want to do this in AutoIT of from another program like Paint.NET C there is a lot of white in there. Is not going to be easy. Share this post Link to post Share on other sites
Yashied 240 Posted September 23, 2010 Photoshop is your friend. My UDFs:iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL HelperAnimated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF LibraryAppropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignmentMore... Share this post Link to post Share on other sites
Malkey 231 Posted September 24, 2010 With this example, zero shade variation gives your girlfriend a white aura. A 0x10 shade variation makes part of her waist transparent. A 0x08 shade variation looks fine. expandcollapse popup#include <GDIPlus.au3> Global $sRegPath, $sImageIn, $sImageOut $sImageIn = FileOpenDialog("First image", "", "All images (*.jpg;*.png;*.gif;*.bmp;)") If $sImageIn = "" Then Exit $sImageOut = @TempDir & "\ModifiedImage.png" _ImageToTransPNG($sImageIn, $sImageOut) If FileExists($sImageIn) Then ShellExecute($sImageIn) Sleep(1000) MsgBox(0, "", 'Press "OK" to continue, and, to view image in black & white') If FileExists($sImageOut) Then ShellExecute($sImageOut) ;parameters ; $iKeepColor - The pixel colour to retain in the image.(Default colour is black, 0xFF000000, in 0xAARRGGBB hex format.) ; $iChangeNotColorTo - The pixel colour to change every colour that is NOT $iKeepColor colour in the image. ; (Default colour is white, 0xFFFFFFFF, in 0xAARRGGBB hex format.) Func _ImageToTransPNG($sInFile, $sOutFile, $iKeepColor = 0xFF000000, $iChangeNotColorTo = 0xFFFFFFFF) Local $hImage, $iW, $iH, $tBitmapData, $iStride, $iScan0 $iKeepColor = StringRegExpReplace(Hex($iKeepColor, 8), "(..)(..)(..)(..)", "\4\3\2\1") ; convert to 0xBBGGRRAA $iChangeNotColorTo = StringRegExpReplace(Hex($iChangeNotColorTo, 8), "(..)(..)(..)(..)", "\4\3\2\1") _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sInFile) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) ;=> Start Work around For XP, GDIPBitmapLockBits() seem to hard crash autoit When using images that are less then 24bpp ; If your using Vista or Newer OS then this won't be called or needed. ;If StringInStr("WIN_2003,WIN_XP,WIN_2000", @OSVersion) Then Local $aRet, $hBmp, $hBitmap, $hGraphic $aRet = _GDIPlus_ImageGetPixelFormat($hImage) If Int(StringRegExpReplace($aRet[1], "\D+", "")) < 24 Then $hBmp = _WinAPI_CreateBitmap($iW, $iH, 1, 32) $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _WinAPI_DeleteObject($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphic) $hImage = _GDIPlus_BitmapCloneArea($hBitmap, 0, 0, $iW, $iH, $GDIP_PXF32ARGB) _GDIPlus_BitmapDispose($hBitmap) EndIf ;EndIf ;=> End Work around $tBitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW, $iH, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) $iStride = DllStructGetData($tBitmapData, "stride") $iScan0 = DllStructGetData($tBitmapData, "Scan0") Local $begin = TimerInit() Local $v_BufferA = DllStructCreate("byte[" & $iH * $iW * 4 & "]", $iScan0) ; Create DLL structure for all pixels Local $AllPixels = DllStructGetData($v_BufferA, 1) Local $sPix1 = StringRegExpReplace(StringTrimLeft($AllPixels, 2), "(.{8})", "\1 ") ; Background colour to transparent $iBkGndCol = "0x" & StringLeft($sPix1, 8) ConsoleWrite($iBkGndCol & @CRLF) $sPix = StringRegExpReplace($sPix1, _ShadeVariationREPattern("0x" & Hex($iBkGndCol, 8), 0x08, False) & " ", "00000000" & " ") ;$sPix = StringRegExpReplace($sPix1, hex($iBkGndCol,8) & " ", "00000000" & " ") ;ConsoleWrite( _ShadeVariationREPattern("0x" & hex($iBkGndCol,8), 0x10,False) & @CRLF) $sPix = "0x" & StringStripWS($sPix, 8) $AllPixels = DllStructSetData($v_BufferA, 1, $sPix) _GDIPlus_BitmapUnlockBits($hImage, $tBitmapData) ;ConsoleWrite("Time: " & TimerDiff($begin) & @CRLF) _GDIPlus_ImageSaveToFile($hImage, $sOutFile) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>_ImageToTransPNG ;======================== _ShadeVariationREPattern =========================== ; Description - Checks if a 24bit color matches a specified color plus or minus a shade varation. ; Parameters ; $iColor - A 'RGB' or 'ARGB' color to test. ; $ShadeVariation - An integer added to and substracted from each color channel of the color, $iColPlusShade. ; $ARGB - If $iColor Format is in 0xAARRGGBB hex format then $ARGB = True is default. ; If false then $iColor Format is in 0xBBGGRRAA hex format. ; Returns 1 (matched) or 0 (no match) ; Func _ShadeVariationREPattern($iColor, $ShadeVariation, $ARGB = True) Local $Pattern, $iColSrchMin, $iColSrchMax If $ARGB Then $iColor = "0x" & StringRegExpReplace(Hex($iColor, 8), "(..)(..)(..)(..)", "\4\3\2\1") ;ConsoleWrite(hex($iColor, 8) & @CRLF) Local $aColor = StringRegExp(Hex($iColor, 8), "(.{2})", 3) For $i = 0 To UBound($aColor) - 2 $Pattern &= "(" $iColSrchMin = "0x" & Hex((Dec(Hex("0x" & $aColor[$i], 2)) - $ShadeVariation) * ((Dec(Hex("0x" & $aColor[$i], 2)) - $ShadeVariation) > 0), 2) $iColSrchMax = "0x" & Hex((Dec(Hex("0x" & $aColor[$i], 2)) + $ShadeVariation + 1) * ((Dec(Hex("0x" & $aColor[$i], 2)) + $ShadeVariation + 1) < 255) + 255, 2) ;ConsoleWrite($iColSrchMin & " to " & $iColSrchMax & @CRLF) For $n = $iColSrchMin To $iColSrchMax $Pattern &= Hex($n, 2) & "|" Next $Pattern = StringTrimRight($Pattern, 1) & ")" Next Return $Pattern & "(FF)" EndFunc ;==>_ShadeVariationREPattern Share this post Link to post Share on other sites
mesale0077 14 Posted November 27, 2010 thank you Malkey Share this post Link to post Share on other sites