au3Fan Posted November 21, 2011 Share Posted November 21, 2011 (edited) Hi, first time here. I'm trying to convert a 24bpp image for 4 bpp following the information contained in the AutoIt help but I'm not progressing ... this is my code: #include <GDIPlus.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $hClone, $hImage, $iX, $iY ; Initialize GDI+ library _GDIPlus_StartUp () $hImage = _GDIPlus_ImageLoadFromFile (@ScriptDir & "logo.bmp") ; Create 4 bit bitmap clone $iX = _GDIPlus_ImageGetWidth ($hImage) $iY = _GDIPlus_ImageGetHeight ($hImage) $hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF04INDEXED ) ; Save bitmap to file _GDIPlus_ImageSaveToFile ($hClone, @ScriptDir & "logo2.bmp") ; Clean up resources _GDIPlus_ImageDispose ($hClone) _GDIPlus_ImageDispose ($hImage) ; Shut down GDI+ library _GDIPlus_ShutDown () EndFunc ;==>_Main Note: I tried without success the following ways: $GDIP_PXF01INDEXED = 1 bit per pixel, indexed $GDIP_PXF04INDEXED = 4 bits per pixel, indexed $GDIP_PXF08INDEXED = 8 bits per pixel, indexed $GDIP_PXF16GRAYSCALE = 16 bits per pixel, grayscale None of them creates the final image in the specified format. However, any RGB mode works correctly. This is a bug? I'm forgetting some info? or GDI+ does not work with indexed images? Please, any help is welcome... Edit: I using WinXp Sp3 machine... Edited November 21, 2011 by au3Fan Link to comment Share on other sites More sharing options...
UEZ Posted November 21, 2011 Share Posted November 21, 2011 Try this: #include <ScreenCapture.au3> _GDIPlus_Startup() $hScreencapture_bmp = _ScreenCapture_Capture("", 0, 0, 320, 256, False) $hBITMAP = _GDIPlus_BitmapCreateFromHBITMAP($hScreencapture_bmp) $hBmpClone = _GDIPlus_BitmapCloneArea($hBITMAP, 0, 0, 320, 256, $GDIP_PXF04INDEXED) ;save bitmap in 2^4 = 16 colors _GDIPlus_ImageSaveToFile($hBmpClone, @ScriptDir & "Test.png") _WinAPI_DeleteObject($hScreencapture_bmp) _GDIPlus_BitmapDispose($hBITMAP) _GDIPlus_BitmapDispose($hBmpClone) _GDIPlus_ShutDown() Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
taietel Posted November 21, 2011 Share Posted November 21, 2011 (edited) It's not working on XP sp3/32. On Windows 7 it's ok. I had the same problem. Returned @error = 0 and @extended = 3.[edit] one workaround would be this... Edited November 21, 2011 by taietel Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
au3Fan Posted November 21, 2011 Author Share Posted November 21, 2011 Thanks UEZ...but is like taitel says, it don´t work on XP.I´ll try in Win7. Link to comment Share on other sites More sharing options...
au3Fan Posted November 24, 2011 Author Share Posted November 24, 2011 Ok ....is a problem with WinXP...... on Win7 it works perfect. Link to comment Share on other sites More sharing options...
Edano Posted May 29, 2013 Share Posted May 29, 2013 after two years, there is a solution for this. you need gdiplus.dll v1.1 on win xp. described [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now