Recent

Author Topic: [BGRA] What's wrong with Resample Filters Lanczos2 and 4 ?  (Read 808 times)

jipété

  • Full Member
  • ***
  • Posts: 172
[BGRA] What's wrong with Resample Filters Lanczos2 and 4 ?
« on: June 14, 2024, 12:38:31 pm »
Hello,

I compare the rendering of the resampling filters and to do this, I use an image that is modified by the 11 classic filters (Box, Linear, etc.) and I noticed that when converting with The Gimp, always in the same way, the .png generated by the graphics tool to bmp's for the comparison tool, 2 files have an alpha channel (I don't know where it comes from) and the 9 other files don't have one :
9+2_layers.png

Here is what I use to convert the base image:     
Code: Pascal  [Select][+][-]
  1.       img.Width  := Wd;
  2.       img.Height := Hd;
  3.       image.ResampleFilter := SelectedFilter; // image is a TBGRABitmap;
  4. // SelectedFilter is coming from another procedure,
  5. procedure TForm1.radiogroupResFiltersClick(Sender: TObject);// radiogroup Items host the 11 filters
  6. begin
  7.   SelectedFilter := TResamplefilter(radiogroupResFilters.ItemIndex);
  8.   imgPaint(nil);
  9. end;
  10. //
  11.       stretched := image.Resample(Wd, Hd) as TBGRABitmap;
That's all.
 
Of course, to watch the result, I then use
Code: Pascal  [Select][+][-]
  1.       copy := image.MakeBitmapCopy(clNone);
  2.       img.Picture.Assign(copy); // and img is a TImage
  3.       copy.Free;

This gives me a different rendering depending on the presence or absence of the alpha channel, and depending on the display tool used, one version or the other:
4resample.gif
Lanczos3--Lanczos4(or2).png

Is it a bug or a feature ?

Thanks,
« Last Edit: June 14, 2024, 12:42:16 pm by jipété »

circular

  • Hero Member
  • *****
  • Posts: 4300
    • Personal webpage
Re: [BGRA] What's wrong with Resample Filters Lanczos2 and 4 ?
« Reply #1 on: June 14, 2024, 07:54:46 pm »
Hi! I am not sure about the steps to reproduce the problem. Would you have a sample program?
Conscience is the debugger of the mind

jipété

  • Full Member
  • ***
  • Posts: 172
Re: [BGRA] What's wrong with Resample Filters Lanczos2 and 4 ?
« Reply #2 on: June 15, 2024, 12:21:23 am »
Would you have a sample program?

Sorry but this afternoon I've changed the way sizes are set-up and problem has disappeared.

I apologize for the inconvenience and you can delete that discussion, if you want to free disk space.
Regards,

circular

  • Hero Member
  • *****
  • Posts: 4300
    • Personal webpage
Re: [BGRA] What's wrong with Resample Filters Lanczos2 and 4 ?
« Reply #3 on: June 15, 2024, 10:54:57 am »
I am glad the problem is solved. This confirms the appearance of the images that looks like a problem of pixel format.

Have a nice day  :)
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018