Image x xImage quality difference

Re: Image x xImage quality difference

Postby karinha » Fri Jun 28, 2024 3: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
User avatar
karinha
 
Posts: 7808
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Re: Image x xImage quality difference

Postby nageswaragunupudi » Fri Jun 28, 2024 4: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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Image x xImage quality difference

Postby nageswaragunupudi » Fri Jun 28, 2024 4: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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Image x xImage quality difference

Postby karinha » Fri Jun 28, 2024 4: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

Image

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7808
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Image x xImage quality difference

Postby Enrico Maria Giordano » Fri Jun 28, 2024 5: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.
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Image x xImage quality difference

Postby nageswaragunupudi » Sun Jun 30, 2024 2: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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Image x xImage quality difference

Postby nageswaragunupudi » Sun Jun 30, 2024 2:38 pm

Dear Mr. Maurício

We are making improvements to the FWH library.

Till then, I suggest this work-around.

Code: Select all  Expand view
#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.

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Image x xImage quality difference

Postby Enrico Maria Giordano » Sun Jun 30, 2024 3:02 pm

nageswaragunupudi wrote:
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.


Please look at the result image that I shared some messages up. How do you see it?
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Image x xImage quality difference

Postby nageswaragunupudi » Sun Jun 30, 2024 6: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: Select all  Expand view
XIMAGE( cFile ) // bad quality

and
Code: Select all  Expand view
XIMAGE( filoadimg( cFile ), , .f. ) // better
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Re: Image x xImage quality difference

Postby nageswaragunupudi » Mon Jul 01, 2024 4: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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Image x xImage quality difference

Postby Enrico Maria Giordano » Mon Jul 01, 2024 7:32 am

I used the samples provided in this thread. Anyway, good to know you are fixed the problem.
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Image x xImage quality difference

Postby concentra » Mon Jul 01, 2024 4: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!
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Image x xImage quality difference

Postby nageswaragunupudi » Tue Jul 02, 2024 7: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: Select all  Expand view
aBmp[ 1 ]   := GDIP_ImageFromFile( uBmp, !lGdipImage, Upper( cFileExt( uBmp ) ) == "GIF" )

we need to chage
Code: Select all  Expand view
=="GIF"

as
Code: Select all  Expand view
$ "GIF,TIFF"

The modified code appears like this:
Code: Select all  Expand view
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: Select all  Expand view
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: Select all  Expand view
XIMAGE( "image.tif",, .f. )


Image

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 32 guests