Sign in to follow this  
Followers 0
Mojo

Need a picture in grayscale

3 posts in this topic

Hi guys,

I'm looking for a way to get a grayscale copy of an image, or even better capture the screen and save it as grayscale bmp or jpg or whatever. Please help!

_GDIPlus_BitmapCloneArea with $GDIP_PXF16GRAYSCALE doesn't seem to work, or does it work with 8 bit images only?

Has anyone ever used those and knows more about it, and can give me some hints?

The piece of code I'm working with is here...

$hBitmap = _ScreenCapture_Capture ("", 0, 0, -1, -1, False)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)
$iX = _GDIPlus_ImageGetWidth ($hImage)
$iY = _GDIPlus_ImageGetHeight ($hImage)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF16GRAYSCALE)

... $hClone returns 0, meaning that there was an error!

Any ideas how to get this to work? - Please help me - thx!

greetz


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites



Have a look at this topic: http://www.autoitscript.com/forum/lofivers...php?t65918.html

It seems that the $GDIP_PXF16GRAYSCALE parameter is to blame. This works fine when the $GDIP_PXF16GRAYSCALE is changed to another value, such as $GDIP_PXF16RGB555. I guess the GDI fails when converting the image type that you have captured to a grayscale format.

This is not the first time someone has has a problem converting something to grayscale:


[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post


Link to post
Share on other sites

Thank you for taking some time and posting an answer.

The topic you mentioned is one I created, but since that was some time ago, I summed it up and created a new one, hoping that someone maybe figured it out in the mean time.

Well, we'll see if that's the case :D


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

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  
Followers 0