Bad quality with GIF (and GDI+)

User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

And we need a solution for loading GIF too.

EMG
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Bad quality with GIF (and GDI+)

Post by mastintin »

when they loaded look good right?
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

No. As I already wrote, with FILoadImage() the GIFs look fine while with GDIP_LOADFROMFILE() don't.

EMG
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Bad quality with GIF (and GDI+)

Post by mastintin »

For me work fine .. ¿?
My code :
gif used for sample https://www.dropbox.com/s/mzibdx1j1h0lo ... 0.gif?dl=0
We show the image at 2X size to appreciate pixels

Code: Select all | Expand


Function Main ()
local ownd
local oimg

 DEFINE WINDOW oWnd TITLE "Testing GDI+ Class" FROM 5,5 TO 500, 890 PIXEL ;
 COLOR CLR_GRAY, CLR_GRAY
   
    @ 20,12 button "crear" size 40,20 pixel Action  oBmpLoadFromFile( oImg, 640, 400 )    
 
    @ 20 ,130 Button "salir" Action ownd:end() size 40,20 pixel
     
    @ 3, 28 BITMAP oimg  FILE "" size 640,400 of oWnd

   ACTIVATE WINDOW oWnd

Return (nil)


Function oBmpLoadFromFile( oBmp, nWidth, nHeight )
local hBmpOld := oBmp:hBitmap
local hPalOld  := oBmp:hPalette
local ohBmp
local hBmp := 0
local cFile:= cGetfile("coge","*.*")
 if ! Empty( cFile )
   ohBmp := GDIBmp():new(cFile)  
    if ( ! Empty( nWidth ) .or. ! Empty( nHeight ) )
        ohBmp:Resize( nWidth, nHeight )
    endif
    hBmp := ohBmp:GetGDIHbitmap()  
    ohBmp:End()  
 endif
 oBmp:hBitmap  := hBmp      
 oBmp:hPalette := 0
 
  if ! Empty( hBmpOld )
     PalBmpFree( hBmpOld, hPalOld )
 endif
 
  obmp:HasAlpha()
  obmp:refresh()
 
RETURN nil

 
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

Please open the GIF with any image viewer and compare with your sample. You'll see the difference.

EMG
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Bad quality with GIF (and GDI+)

Post by mastintin »

Enrico ,I do not find significant differences.
Paste a screenshot with 4 images. top-left gdi+ , bottom-left freeimage , top-right pixelformer and bottom-right viewer macOsx.
Image
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

Too small to see any differences. Anyway, try to send me your EXE to test it here.

EMG
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Bad quality with GIF (and GDI+)

Post by mastintin »

the program :
for jpg,gif,tif,bmp,ico files
https://www.dropbox.com/s/sr2lij7jughmh ... 4.rar?dl=0
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

Your EXE seems to work fine! Can I have the source code, please? The one that you gave me is different.

EMG
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Bad quality with GIF (and GDI+)

Post by mastintin »

Enrico , code here :https://www.dropbox.com/s/tpbv93i3gxv187y/gdiplus4.prg?dl=0
with emf fines work fine also.
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

Ok, it doesn't work fine here. So you are not using the official FWH build 4 from Fivetech website, right?

EMG
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by nageswaragunupudi »

1) If a programmer prefers to use FreeImage, he can set UseGDI( .f. ). We provided this toggle so that the programmer can choose what he considers better.

2) Mr EMG is comparing the GDI+ code as adopted by FWH with the quality of FreeImage.

3) Possible that Mr Manuel has improved code. If Mr Manuel feels FWH code needs improvement, we would be glad to incorporate his contribution.
Regards

G. N. Rao.
Hyderabad, India
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Bad quality with GIF (and GDI+)

Post by mastintin »

Enrico , All code uses the official version fwh build 4 .
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

So I'm lost. I don't know what the difference could be. I'm using official FWH build 4 and BCC 7.1. Tried with Harbour and xHarbour. :-(

EMG
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Bad quality with GIF (and GDI+)

Post by mastintin »

enrico , please send your exe file to compare here. I use harbour , bcc7 and fwh 15.09 build4 also. ¿? :-(
Post Reply