FreeImage Library
#41
Posted 03 May 2011 - 03:36 PM
#42
Posted 03 May 2011 - 05:14 PM
C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(690,41) : ERROR: syntax error Global Const $JPEG_OPTIMIZE = 0x20000 / / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(691,41) : ERROR: syntax error Global Const $JPEG_BASELINE = 0x40000 / / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(732,27) : ERROR: syntax error Global Const $TIFF_LOGLUV 0 ~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1755,163) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine1To16_555@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1761,163) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine4To16_555@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1767,163) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine8To16_555@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1791,163) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine1To16_565@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1797,163) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine4To16_565@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1803,163) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine8To16_565@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1827,159) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine1To24@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1833,159) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine4To24@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1839,159) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine8To24@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1863,159) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine1To32@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1869,159) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine4To32@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jack\Desktop\freeimage0\FreeImage.au3(1875,159) : ERROR: syntax error Local $result = DllCall($__g_hFREEIMAGEDLL, "none", "_FreeImage_ConvertLine8To32@16", "ptr", $target, "ptr", $source, "int", $width_in_pixels, "ptr", palette) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
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 Helper
Animated 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 | IconChooser 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 | AITray UDF Library

#43
Posted 03 May 2011 - 05:22 PM
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.
RegisterDeviceNotifications | FunctionNameLister | SciTE Customization GUI | MouseHover --> CallTips
#44
Posted 03 May 2011 - 05:33 PM
@LaCastiglione: Thank you for that meaningful comment.
Edited by ProgAndy, 03 May 2011 - 05:38 PM.
#45
Posted 24 June 2011 - 04:20 PM
I had a question as far as manipulating pixel data. I have everything working perfectly, until I get to the spot where I need to change the value that the "$bits" pointer points to.
#include <FreeImage.au3> OnAutoItExitRegister("Cleanup") func Main() _FreeImage_LoadDLL(@ScriptDir&"\FreeImage.dll") _FreeImage_Initialise() ;============================================================================= Global $image = _FreeImage_Load($FIF_TIFF, "test.tif") $bitdepth = _FreeImage_GetBPP($image) $bitsperpixel = _FreeImage_GetLine($image) / _FreeImage_GetWidth($image) Msgbox(0, "", $bitsperpixel) Local $bits ;$temp = _FreeImage_GetChannel($image, $FICC_RED) $y = 0 $x = 0 for $y = 0 to _FreeImage_GetHeight($image) step 1 $bits = _FreeImage_GetScanLine($image, $y) ;Tooltip($bits) for $x = 0 to _FreeImage_GetWidth($image) step 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;Manipulate Pixel here;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $bits = $bits + $bitsperpixel next next Msgbox(0, "", "Done") _FreeImage_Save($FIF_TIFF, $image, "test.tif") endfunc Main() Exit func Cleanup() _FreeImage_Unload($image) _FreeImage_DeInitialise() endfunc
I've been looking everywhere for how to manipulate data from a pointer (Like in C++, the simple *ptr), and all I'm getting is Cheat Engine stuff
#46
Posted 24 June 2011 - 04:51 PM
#include <FreeImage.au3> _FreeImage_LoadDLL(@ScriptDir&"\FreeImage.dll") _FreeImage_Initialise() OnAutoItExitRegister("Cleanup") $sFile = @DesktopDir&"\test.tif" ;============================================================================= Global $image = _FreeImage_Load($FIF_TIFF, $sFile) If Not $image Then Exit $bitsperpixel = _FreeImage_GetBPP($image) $bytespp = $bitsperpixel / 8 $iType = _FreeImage_GetImageType($image) If $iType = $FIT_BITMAP And ($bitsperpixel = 32) Then $y = 0 $x = 0 $h = _FreeImage_GetHeight($image) $w = _FreeImage_GetWidth($image) for $y = 0 to $h-1 step 1 $bits = _FreeImage_GetScanLine($image, $y) $t = DllStructCreate("align 4; dword[" & $w & "]", $bits) for $x = 1 to $w step 1 $pix = DllStructGetData($t, 1, $x) $pix = BitOR(BitAND($pix, 0xFF00FF00), BitShift(BitAND($pix, 0x00FF0000), 16), BitShift(BitAND($pix, 0x000000FF), -16)) DllStructSetData($t, 1, $pix, $x) next next _FreeImage_Save($FIF_TIFF, $image, @DesktopDir&"\test.tif") Msgbox(0, "", "Done") Else MsgBox(0, '', "Not supported") EndIf _FreeImage_Unload($image) Exit func Cleanup() _FreeImage_DeInitialise() endfunc
Edited by ProgAndy, 24 June 2011 - 04:52 PM.
#47
Posted 24 June 2011 - 09:47 PM
#48
Posted 11 December 2011 - 11:46 PM
#49
Posted 14 December 2011 - 10:21 PM
#include <FreeImage.au3> _FreeImage_LoadDLL(@ScriptDir&"FreeImage.dll") _FreeImage_Initialise() $sFile = "test.tif" $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $image = _FreeImage_LoadU($FIF, $sFile) $bitsperpixel = _FreeImage_GetBPP($image) MsgBox(0, '', "$bitsperpixel="&$bitsperpixel) _FreeImage_Unload($image) _FreeImage_DeInitialise()
When i use it on test.tif, result is "$bitsperpixel=24", but color of .tif is CMYK...
Why? How to use FreeImage with CMYK pictures?
Edited by One, 14 December 2011 - 10:22 PM.
#50
Posted 14 December 2011 - 10:29 PM
found mistake:My code:
#include <FreeImage.au3> _FreeImage_LoadDLL(@ScriptDir&"FreeImage.dll") _FreeImage_Initialise() $sFile = "test.tif" $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $image = _FreeImage_LoadU($FIF, $sFile) $bitsperpixel = _FreeImage_GetBPP($image) MsgBox(0, '', "$bitsperpixel="&$bitsperpixel) _FreeImage_Unload($image) _FreeImage_DeInitialise()
When i use it on test.tif, result is "$bitsperpixel=24", but color of .tif is CMYK...
Why? How to use FreeImage with CMYK pictures?
must be "$image = _FreeImage_LoadU($FIF, $sFile, $TIFF_CMYK)"
#51
Posted 09 May 2012 - 09:54 AM
this work fine
#Include <FreeImage.au3> $sFile = 'Test.png' _FreeImage_LoadDLL(@ScriptDir & 'FreeImage.dll') _FreeImage_Initialise() $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $hImage = _FreeImage_LoadU($FIF, $sFile) $hGrey = _FreeImage_ConvertToGreyscale($hImage) _FreeImage_SaveU($FIF_PNG, $hGrey, @ScriptDir & 'Test_Grey.png') _FreeImage_Invert($hGrey) _FreeImage_SaveU($FIF_PNG, $hGrey, @ScriptDir & 'Test_Grey_Inverse.png') _FreeImage_Unload($hImage) _FreeImage_Unload($hGrey) _FreeImage_DeInitialise()
but this wrong
#Include <FreeImage.au3> $PatchTXT = FileOpenDialog ( "Choice text file", @ScriptDir, "Text files (*.txt)", 2+16, "") $TXT = FileOpen($PatchTXT, 0) $sFile = 'Test.png' _FreeImage_LoadDLL(@ScriptDir & 'FreeImage.dll') _FreeImage_Initialise() $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $hImage = _FreeImage_LoadU($FIF, $sFile) $hGrey = _FreeImage_ConvertToGreyscale($hImage) _FreeImage_SaveU($FIF_PNG, $hGrey, @ScriptDir & 'Test_Grey.png') _FreeImage_Invert($hGrey) _FreeImage_SaveU($FIF_PNG, $hGrey, @ScriptDir & 'Test_Grey_Inverse.png') _FreeImage_Unload($hImage) _FreeImage_Unload($hGrey) _FreeImage_DeInitialise()
script looking png file in directory where i choice txt file
but i have png in script dir
sorry for my eng i from ukraine )
Edited by SyavaK, 09 May 2012 - 09:58 AM.
#52
Posted 09 May 2012 - 01:31 PM
#53
Posted 09 May 2012 - 02:30 PM
Looks like a captcha, which we don't discuss or help with.
understand sorry
Edited by SyavaK, 09 May 2012 - 02:42 PM.
#54
Posted 09 May 2012 - 02:38 PM
How to ask questions the smart way!
Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.
#55
Posted 23 August 2012 - 06:11 PM
Also would just like to thank you for making such an awesome script
Func _ProcessImage($Input, $Output) $sFile = $Input $iTWidth = 600 $iTHeight = 800 _FreeImage_Initialise() $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $hImage = _FreeImage_LoadU($FIF, $sFile) $oWidth = _FreeImage_GetWidth($hImage) $oHeight = _FreeImage_GetHeight($hImage) $Ratio = $oWidth / $oHeight If $Ratio > 1 Then $hImage = _FreeImage_RotateClassic($hImage, 90) EndIf $hImage = _FreeImage_Rescale($hImage, $iTWidth, $iTHeight, $FILTER_BILINEAR) $hImage = _FreeImage_ConvertToGreyscale($hImage) _FreeImage_SaveU($FIF_PNG, $hImage, $Output) _FreeImage_Unload($hImage) _FreeImage_DeInitialise() EndFunc
#56
Posted 07 January 2013 - 07:11 PM
_FreeImage_SaveU($FIF, $hImageResized, $Name &"_rsz"&$Ext, $JPEG_OPTIMIZE&'|'&$JPEG_SUBSAMPLING_422&'|'&$JPEG_QUALITYSUPERB)
But the results I am seeing does not indicate that the flags are being picked up right, file size way too small compared to simply passing the JPEG_QUALITYSUPERB flags on its own. Any ideas?
- Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)
- Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)
- Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)
- Change focus behavior when buttons are clicked to work closer to 'standard windows' app
- (Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3
- Clipboard UDF, A clipboard change notification udf
#57
Posted 11 January 2013 - 12:37 PM
Hi,Hi ProgAndy, thanks for your work on interfacing this lib; I seem to be having some issues with combining flags when saving using the "_FreeImage_SaveU" function, basically calling it like this:
_FreeImage_SaveU($FIF, $hImageResized, $Name &amp;amp;"_rsz"&amp;amp;$Ext, $JPEG_OPTIMIZE&amp;amp;'|'&amp;amp;$JPEG_SUBSAMPLING_422&amp;amp;'|'&amp;amp;$JPEG_QUALITYSUPERB)
But the results I am seeing does not indicate that the flags are being picked up right, file size way too small compared to simply passing the JPEG_QUALITYSUPERB flags on its own. Any ideas?
did you try the BitOr function instead of the '&' sign?.
_FreeImage_SaveU($FIF, $hImageResized, $Name & "_rsz"&$Ext, BitOR($JPEG_OPTIMIZE,$JPEG_SUBSAMPLING_422,$JPEG_QUALITYSUPERB))
Edited by Sundance, 11 January 2013 - 12:44 PM.
- Sunaj likes this
#58
Posted 11 January 2013 - 12:49 PM
i have also a problem. Hope you can give me a hint or two :-)
I need to make the white color of a quantized picture transparent. There is an example in the pdf
#include "FreeImage.h" int main(int argc, char* argv[]) { FIBITMAP *hDIB24bpp = FreeImage_Load(FIF_BMP, "test.bmp", 0); if (hDIB24bpp) { // color-quantize 24bpp (results in a 8bpp bitmap to set transparency) FIBITMAP *hDIB8bpp = FreeImage_ColorQuantize(hDIB24bpp, FIQ_WUQUANT); // get palette and find bright green RGBQUAD *Palette = FreeImage_GetPalette(hDIB8bpp); BYTE Transparency[256]; for (unsigned i = 0; i < 256; i++) { Transparency[i] = 0xFF; if (Palette[i].rgbGreen >= 0xFE && Palette[i].rgbBlue == 0x00 && Palette[i].rgbRed == 0x00) { Transparency[i] = 0x00; } } // set the tranparency table FreeImage_SetTransparencyTable(hDIB8bpp, Transparency, 256); // save 8bpp image as transparent PNG FreeImage_Save(FIF_PNG, hDIB8bpp, "test.png", 0); FreeImage_Unload(hDIB24bpp); FreeImage_Unload(hDIB8bpp); } return 0; }
My problem is; how can i create a proper structure for the palette? I think it should be 256 times a RGBQUAD structure but i have no idea how to set the value of (ex.) Palette[i].rgbBlue ....
Could be i think to complex but would be nice if you got an idea :-)
Thanks in advance and happy weekend
sundance
EDIT: I GOT IT. :-)
If someone is interested, i will post it after the weekend...
Edited by Sundance, 11 January 2013 - 02:43 PM.
#59
Posted 12 January 2013 - 11:42 PM
I could have sworn I did.. but obviously didn't because this works, thanks a lot for taking time to reply, made myHi,
did you try the BitOr function instead of the '&' sign?.
_FreeImage_SaveU($FIF, $hImageResized, $Name & "_rsz"&$Ext, BitOR($JPEG_OPTIMIZE,$JPEG_SUBSAMPLING_422,$JPEG_QUALITYSUPERB))
- Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)
- Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)
- Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)
- Change focus behavior when buttons are clicked to work closer to 'standard windows' app
- (Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3
- Clipboard UDF, A clipboard change notification udf
#60
Posted 12 January 2013 - 11:49 PM
I certainly am interested, do post away - used to hack a lot about with http://pngquant.org/ so be interested to see what freeimage can (not?) do when compared!Andy,
i have also a problem. Hope you can give me a hint or two :-)
I need to make the white color of a quantized picture transparent. There is an example in the pdfPlain Text#include "FreeImage.h" int main(int argc, char* argv[]) { FIBITMAP *hDIB24bpp = FreeImage_Load(FIF_BMP, "test.bmp", 0); if (hDIB24bpp) { // color-quantize 24bpp (results in a 8bpp bitmap to set transparency) FIBITMAP *hDIB8bpp = FreeImage_ColorQuantize(hDIB24bpp, FIQ_WUQUANT); // get palette and find bright green RGBQUAD *Palette = FreeImage_GetPalette(hDIB8bpp); BYTE Transparency[256]; for (unsigned i = 0; i < 256; i++) { Transparency[i] = 0xFF; if (Palette[i].rgbGreen >= 0xFE && Palette[i].rgbBlue == 0x00 && Palette[i].rgbRed == 0x00) { Transparency[i] = 0x00; } } // set the tranparency table FreeImage_SetTransparencyTable(hDIB8bpp, Transparency, 256); // save 8bpp image as transparent PNG FreeImage_Save(FIF_PNG, hDIB8bpp, "test.png", 0); FreeImage_Unload(hDIB24bpp); FreeImage_Unload(hDIB8bpp); } return 0; }
My problem is; how can i create a proper structure for the palette? I think it should be 256 times a RGBQUAD structure but i have no idea how to set the value of (ex.) Palette[i].rgbBlue ....
Could be i think to complex but would be nice if you got an idea :-)
Thanks in advance and happy weekend
sundance
EDIT: I GOT IT. :-)
If someone is interested, i will post it after the weekend...
- Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)
- Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)
- Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)
- Change focus behavior when buttons are clicked to work closer to 'standard windows' app
- (Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3
- Clipboard UDF, A clipboard change notification udf
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users






