Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using GDI+ for changes from color to Gray
Message
From
07/05/2008 07:03:00
Arnold Lee
K&A International Co.,Ltd
Hong Kong, Hong Kong
 
 
To
07/05/2008 06:47:38
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01315104
Message ID:
01315544
Views:
35
Hello Cesar

Tks for your input.It works like a charm.
Used to I uses GDI to made thumbnail and save as a file and uses filetostr() to get the string and save to memo field.Of course it works but have to erase the tmp file everytime.may it would be nice if simialr function is available on resize function of gdiplusx.

Thank you very much.

Arnold


>Very simple too.
>
>The most simple aproach is to use either GETPICTUREVALFROMHBITMAP() or GetPictureVal() functions.
>
>For more options, please read carefully the commented lines:
>
>
>
** HOWTO: Get a Monochromatic 1 bit per pixel image
>
>DO LOCFILE("System.App")
>
>WITH _SCREEN.System.Drawing
>   * Create a Bitmap object based on a BMP file.
>   LOCAL loOriginalBmp AS xfcBitmap
>   loOriginalBmp = .Bitmap.New(GETPICT())
>
>   LOCAL loMonoChrBmp as xfcBitmap
>   loMonoChrBmp = loOriginalBmp.GetMonochrome()
>
>   * Dispose the original Bitmap because we don't need it any more
>   loOriginalBmp = NULL
>	
>   * Save the created Monochromatic Bmp
>*   loMonochrBmp.Save("c:\Monochromatic.bmp", .Imaging.ImageFormat.Bmp)
>
>   * Get the Image binaries directly:
>   LOCAL lcImgBinaries
>   lcImgBinaries = loMonochrBmp.GetPictureValFromHBitmap()
>
>   * For a different image format than BMP, a little slower, but if you use this the image format will not be 1bpp any more:
>*   LOCAL lcImgBinaries
>*   lcImgBinaries = loMonochrBmp.GetPictureVal(.Imaging.ImageFormat.Jpeg)
>
>
>ENDWITH
>
>RETURN
>
>
>
>
>
>
>>Thanks for gdiplusx. getmonochrome() and example start me up.
>>
>>May i know is it possible to return a binary stream (like from filetostr()) from xfcBitmap object so i can save the string to memo file rightaway ?
>>
>>Thank you.
>>
>>
>>>>Dear Cesar
>>>>
>>>>How are you ?
>>>>I know you are very interested in using GDI :)
>>>>In fact, i would like to convert the color jpg to 1bit black/white file for special purpose printing. could you enlighting me ? Tks
>>>>
>>>
>>>See if this helps you:
>>>
>>>PS: Requires GdiPlusX
>>>
>>>
>>>
>>>
** HOWTO: Get a Monochromatic 1 bit per pixel image
>>>
>>>DO LOCFILE("System.App")
>>>
>>>WITH _SCREEN.System.Drawing
>>>   * Create a Bitmap object based on a BMP file.
>>>   LOCAL loOriginalBmp AS xfcBitmap
>>>   loOriginalBmp = .Bitmap.New(GETPICT())
>>>
>>>   LOCAL loMonoChrBmp as xfcBitmap
>>>   loMonoChrBmp = loOriginalBmp.GetMonochrome()
>>>
>>>   * Dispose the original Bitmap because we don't need it any more
>>>   loOriginalBmp = NULL
>>>	
>>>   * Save the created Monochromatic Bmp
>>>   loMonochrBmp.Save("c:\Monochromatic.bmp", .Imaging.ImageFormat.Bmp)
>>>ENDWITH
>>>
>>>RETURN
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform