Jump to content

Bad image quality in Uni(m)DBGrid


likemike

Recommended Posts

Hello!

I use the fieldimage option in an UnimDBGrid.

Code:

PROCEDURE TMainmForm.UnimDBGridFieldImage(CONST Column: TunimDBGridColumn; CONST AField: TField; VAR OutImage: TGraphic; VAR DoNotDispose: BOOLEAN; VAR ATransparent: TUniTransparentOption);
VAR unimImage: TUnimImage;
BEGIN
    IF AField.FieldName='GRAFIK' THEN BEGIN
        DoNotDispose:=TRUE;
        ATransparent:=toNone; { !! }
        IF TFile.Exists('Picture1.jpg') THEN BEGIN
            unimImage:=TUnimImage.Create(self);
            TRY
                unimImage.Picture.LoadFromFile('Picture1.jpg');
                OutImage:=TBitmap.Create;
                WITH (OutImage AS TBitmap) DO BEGIN
                    Transparent:=FALSE; { !! }
                    SetSize(200, 200);
                    OutImage.Assign(unimImage.Picture.Graphic);
                END;
            FINALLY
                unimImage.Free;
            END;
        END;
    END;
END;

In the grid the picture is shown transparent although I set all transparency values to false.

Here a screenshot with focus - you can see the cloudy part of the picture at the left bottom appears yellow:

s1.jpg.bf02a2594680ca99a61600f1847c23a8.jpg

here without focus - you can see the cloudy part of the picture at the left bottom appears lightblue:

s2.jpg.d6c00d2af7349d0b014f526af1761f87.jpg

and here is the picture how it should be displayed:

s3.jpg.53e5691161290b22112c7f002a87e0c0.jpg

Any help would be appreciated!

Best regards

Mike

 

Link to comment
Share on other sites

  • 2 weeks later...

Hello Sherzod!

I think the problem results form that line: 

SetSize(200, 200);

If the source picture already has the used size (here 200x200), the picture is displayed correctly. If the picture has a bigger size, the quality decreases when resizing it.

My workaround is to transform all pictures to the wanted size before loading.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...