Jump to content
Sign in to follow this  

GDI decreasing the number of color How to

Recommended Posts


I ind to tra,sform a capture in 16 colors greyscale but it seems that someone is not working

#include <GDIPLUS.au3>
#include  <ScreenCapture.au3>

   ; Get JPEG encoder CLSID
    $sCLSID = _GDIPlus_EncodersGetCLSID ("JPEG")
     $hBitmap = _ScreenCapture_Capture ("")
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)
    $tData = DllStructCreate("int Data")
    DllStructSetData($tData, "Data",$GDIP_PXF16GRAYSCALE )
    $tParams = _GDIPlus_ParamInit (1)
    _GDIPlus_ParamAdd ($tParams, $GDIP_EPGCOLORDEPTH , 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))
  ; Save bitmap to file
      _GDIPlus_ImageSaveToFileEx ($hImage, @desktopdir& "\GDIPlus_Image2.jpg", $sCLSID,DllStructGetPtr($tParams))

   ; Clean up resources
  ; _GDIPlus_ImageDispose ($hClone)
    _GDIPlus_ImageDispose ($hImage)
    _WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
    _GDIPlus_ShutDown ()

What is wrong

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this