I'm using the new GDI+ function and they work very well with JPGs, TIFs and PNGs but GIFs are rendered with very bad quality.
Someone can confirm?
EMG
I'm using the new GDI+ function and they work very well with JPGs, TIFs and PNGs but GIFs are rendered with very bad quality.
Someone can confirm?
EMG
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL cSrcImage := "c:\fwh\bitmaps\magic.bmp"
LOCAL cDstImage := "magic.gif"
LOCAL oGdi := GDIBmp():New( cSrcImage )
oGdi:Save( cDstImage )
oGdi:End()
RETURN NILEnrico .
We had a picture of 32 or 24 bits to 8 bits . The maximum number of colors is 256 for gif files.
The problem is that Microsoft gdi+ also uses the halftone palette (compatible 100% web) for gif conversion,which it makes the colors that are not in the table web It is changed to the nearest.
There is no easy solution
.
We would have to:
go to gdi1.0 to GDI 1.1 and some operating systems let out (not good).
It could save the original palette but not as we could tell GDI+ to use that instead the halftone palette when save image .
So, it would be honest to drop the GIF compatibility. ![]()
EMG
Or to find another way to load a GIF.
EMG
mastintin wrote:go to gdi1.0 to GDI 1.1 and some operating systems let out (not good).
Enrico Maria Giordano wrote:mastintin wrote:go to gdi1.0 to GDI 1.1 and some operating systems let out (not good).
What Windows versions support GDI+ 1.1 natively?
EMG
more news...
https://msdn.microsoft.com/en-us/library/aa479306.aspx
here all code in C ++ to use ColorQuantizer.
mastintin wrote:more news...
https://msdn.microsoft.com/en-us/library/aa479306.aspx
I guess you can adapt the code. When you have a little time I look at you could do.
here all code in C ++ to use ColorQuantizer.
Sorry, I cannot be of any help on this subject... ![]()
EMG
I just made a test: I replace GDIP_IMAGEFROMFILE() with FILOADIMG() and the result is how is should be. So the problem seems to be located in the loading function GDIP_IMAGEFROMFILE() (and probably in GDIPLUSIMAGELOADCACHEDFILE() too).
I don't know if this can help though.
EMG
in c:\fwh\source\winapi\gdiplus.cpp
METHOD Save( cFile , nQuality ) CLASS GDIBmp
local cExtension := Upper(cFileExt(cFile))
local cCLSID
local hQuality := nil
local nScan:= aScan( ::aExtEnd, cExtension )
//local cGUI := AnsiToWide("{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}" )
local cTempFile
if nScan == 0
msginfo( "Formato no soportado" )
Return .f.
endif
if cExtension == "GIF"
nScan := 1
endif
cCLSID := ::aCLSID[ nScan ]
cCLSID = AnsiToWide( cCLSID )
cFile = AnsiToWide( cFile )
if cExtension == "GIF"
cTempFile := cTempFile()
GdiPlusImageSave( ::hBmp, cTempFile, cCLSID )
FIConvertImageFile( cTempFile, cFile )
FErase( cTempFile )
else
if !Empty( nQuality ) .and. cExtension == "JPG"
GdiPlusImageSaveQuality( ::hBmp, cFile, cCLSID, nQuality )
else
GdiPlusImageSave( ::hBmp, cFile, cCLSID )
endif
endif
Return nilIf I read correctly, it uses FreeImage, right? If yes, it's not a useful solution, sorry.
EMG