FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Image x xImage quality difference
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Image x xImage quality difference
Posted: Fri Jun 28, 2024 03:38 PM
Enrico Maria Giordano wrote:Here it is:

https://imgur.com/a/1BC3S4a
In reality, Enrico, the quality of this IMAGE.TIF looks bad, even in IRFANVIEW.exe.

En realidad, Enrico, la calidad de este IMAGE.TIF se ve mala, incluso en IRFANVIEW.exe.

gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Image x xImage quality difference
Posted: Fri Jun 28, 2024 03:44 PM
It looks fine here, even with IrfanView:

https://imgur.com/a/bjl6ouZ

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Image x xImage quality difference
Posted: Fri Jun 28, 2024 04:05 PM
Enrico Maria Giordano wrote:Here it is:

https://imgur.com/a/1BC3S4a
Yes.
TImage (which uses freeimage.dll ) renders the image much better than XImage which uses Microsofts GDI+.
Now we need to check and see how to make this better for our users.
We should aim at rendering on par with Windows photo viewer or Irfanview.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Image x xImage quality difference
Posted: Fri Jun 28, 2024 04:07 PM
In reality, Enrico, the quality of this IMAGE.TIF looks bad, even in IRFANVIEW.exe.
The image we see on this forum is of a lesser quality than what the user actually sees on his computer.
Regards



G. N. Rao.

Hyderabad, India
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Image x xImage quality difference
Posted: Fri Jun 28, 2024 04:33 PM
nageswaragunupudi wrote:
In reality, Enrico, the quality of this IMAGE.TIF looks bad, even in IRFANVIEW.exe.
The image we see on this forum is of a lesser quality than what the user actually sees on his computer.
Exactly Master Rao. Here on Windows 7, the image is horrible.

Exactamente Maestro Rao. Aquí en Windows 7, la imagen es horrible.

TIFF High Quality,

https://imgur.com/QYPXAEC



Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Image x xImage quality difference
Posted: Fri Jun 28, 2024 05:31 PM

I don't understand. I see an image of good quality here, no white stains on it. I can't reproduce the problem here.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Image x xImage quality difference
Posted: Sun Jun 30, 2024 02:34 PM
Enrico Maria Giordano wrote:I don't understand. I see an image of good quality here, no white stains on it. I can't reproduce the problem here.
I am pleasantly surprised that you do not see any problem at you end. I am unable to explain. But I do see the difference here, even with my poor eye-sight, while testing with the TIF file he has sent me.

On testing I noticed that reading "this" tif file with GDI+ is producing a bad quality image while reading with freeimage.dll is producing a good quality image. May be our code to read TIF files with GDI+ is defective and we will examine that in due course with the help of experts.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Image x xImage quality difference
Posted: Sun Jun 30, 2024 02:38 PM
Dear Mr. Maurício

We are making improvements to the FWH library.

Till then, I suggest this work-around.
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg, oImage, cFile := "image.tif"

   DEFINE DIALOG oDlg SIZE 1000,900 PIXEL TRUEPIXEL RESIZABLE

   @ 20,20 XIMAGE oImage FILE FILOADIMG( cFile ) SIZE -20,-20 OF oDlg
   oImage:lBmpTransparent := .f.

   ACTIVATE DIALOG oDlg CENTERED

return nil
Please try with all your TIF files and provide your feedback.

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Image x xImage quality difference
Posted: Sun Jun 30, 2024 03:02 PM
nageswaragunupudi wrote:
I don't understand. I see an image of good quality here, no white stains on it. I can't reproduce the problem here.
I am pleasantly surprised that you do not see any problem at you end. I am unable to explain. But I do see the difference here, even with my poor eye-sight, while testing with the TIF file he has sent me.
Please look at the result image that I shared some messages up. How do you see it?
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Image x xImage quality difference
Posted: Sun Jun 30, 2024 06:42 PM
Please look at the result image that I shared some messages up. How do you see it?
That was by Irfanview and its ok.
The problem is with TXImage. TImage is ok.

You can see the difference in the quality between
Code (fw): Select all Collapse
XIMAGE( cFile ) // bad quality
and
Code (fw): Select all Collapse
XIMAGE( filoadimg( cFile ), , .f. ) // better
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Image x xImage quality difference
Posted: Sun Jun 30, 2024 07:25 PM
I already reported my results:

https://imgur.com/a/1BC3S4a

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Image x xImage quality difference
Posted: Mon Jul 01, 2024 04:25 AM
I don't know if it helps...
If I am correct, I took the handle of an Image object and used it as source of a xImage object and the quality in the screen are is the same.
This make me thinking that the issue can be only when showing the image on screen.
Yes, in this case, we get the same quality with both TImage and TXImage. The reason is the hBitmap of TImage is read with freeimage.dll.
The problem is with reading of Tif.
TImage always uses freeimage.dll. The quality is good when read with freeimage.dll.

Anyway,
we made improvements for the next version.
For all existing versions, the workaround provided above will provide good quality
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Image x xImage quality difference
Posted: Mon Jul 01, 2024 07:32 AM

I used the samples provided in this thread. Anyway, good to know you are fixed the problem.

Posts: 124
Joined: Mon Nov 14, 2005 10:15 AM
Re: Image x xImage quality difference
Posted: Mon Jul 01, 2024 04:14 PM
nageswaragunupudi wrote:I suggest this work-around.
This worked very well.
Thanks.

Only for the record, Windows Photo seems to give a slightly better image. Better focus ? Or Windows Photo itself enhances the image ?
But your solution is good enough to my needs.

Again, very thanks!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Image x xImage quality difference
Posted: Tue Jul 02, 2024 07:20 AM
We resolved the issue with gdi+.
No need for any workarounds now.

We suggest a small fix which works for all TIF files from disk.

FIX:
Please locate this line of code in the function FW_ReadImage(…)
in \fwh\source\function\imgtxtio.prg:
Code (fw): Select all Collapse
aBmp[ 1 ]   := GDIP_ImageFromFile( uBmp, !lGdipImage, Upper( cFileExt( uBmp ) ) == "GIF" )
we need to chage
Code (fw): Select all Collapse
=="GIF"
as
Code (fw): Select all Collapse
$ "GIF,TIFF"
The modified code appears like this:
Code (fw): Select all Collapse
aBmp[ 1 ]   := GDIP_ImageFromFile( uBmp, !lGdipImage, Upper( cFileExt( uBmp ) ) $ "GIF,TIFF" )
With this fix, you need not use the above work around.
But you keep
Code (fw): Select all Collapse
oImage:lBmpTransparent := .f.
The results as tested by us are good and as good as Microsoft Photo.
This is a screenshot comparing Microsoft Photo (left) and xImage(right)
Test program
Code (fw): Select all Collapse
XIMAGE( "image.tif",, .f. )


With this fix, we can view tif files even with TBitmap
Regards



G. N. Rao.

Hyderabad, India