Recent

Author Topic: TImage artifact  (Read 578 times)

user5

  • Sr. Member
  • ****
  • Posts: 284
TImage artifact
« on: August 02, 2020, 09:06:56 pm »
    I have a TImage on a form that contains a picture as shown in the attached graphic. The image on the left in the attached graphic is what the image looks like when the TImage is non-transparent. The image on the right in the attached graphic is what the image looks like when the TImage is made to be transparent. As you can see, the image on the right has an artifact at the bottom right hand corner that doesn't go transparent like the rest of the image. The color of the artifact must be a bit different color than the rest of the image. When I slightly increase the contrast then the artifact disappears.
    Does anyone know what causes this?

winni

  • Hero Member
  • *****
  • Posts: 1992
Re: TImage artifact
« Reply #1 on: August 02, 2020, 09:20:37 pm »
Hi!

The artefact line appears because there the original color is not exactly Magenta 255/0/255 but slightly different. So it is not accepted to be the color to be made transparent.

If you give more contrast it reaches exact the magenta  (aka Fuchsia) value and is accepted.

That's  the whole secret.

Winni
« Last Edit: August 02, 2020, 09:22:35 pm by winni »

user5

  • Sr. Member
  • ****
  • Posts: 284
Re: TImage artifact
« Reply #2 on: August 03, 2020, 03:15:58 am »
    Thank you for your reply. Have you ever run across this kind of thing before or know what causes it?

Handoko

  • Hero Member
  • *****
  • Posts: 3902
  • My goal: build my own game engine using Lazarus
Re: TImage artifact
« Reply #3 on: August 03, 2020, 04:25:31 am »
That issue usually happens if you got the source from jpeg or other lossy compression image formats. If I need high quality color images, I usually draw it myself and save them in png file format.

If you zoom the image to extreme scale then you can see the pixel colors of the body of the lighter is very non-uniform, which usually means it has ever been saved to jpeg format.

user5

  • Sr. Member
  • ****
  • Posts: 284
Re: TImage artifact
« Reply #4 on: August 03, 2020, 02:50:41 pm »
    I haven't had much to do with JPEGs. The artifact problem I mentioned involved BMPs and PNGs extracted from videos. I increased the quality settings in the program doing the extractions and that fixed the problem.
    This may sound strange but sometimes it seems like just coming to this forum is a catalyst for solving problems. This artifact problem was a big issue for me and fixing it is just great.
    Once again this forum came through fer me. All praise to Lazarus.

Handoko

  • Hero Member
  • *****
  • Posts: 3902
  • My goal: build my own game engine using Lazarus
Re: TImage artifact
« Reply #5 on: August 03, 2020, 04:15:53 pm »
The artifact problem I mentioned involved BMPs and PNGs extracted from videos.

That explains why it happened. Almost all video codecs use lossy compression techniques.

 

TinyPortal © 2005-2018