Resizing a grayscale image does not work properly

I think I found a bug in GIMP 2.10.8 (or in the Appimage from @Carmelo_DrRaw ).

As you can see in the following included screenshot, I have a 16bit grayscale tiff image (scanned film) and I try to resize it with the new GIMP 2.10.8 (Image → Scale Image…).
The outcome of the scale is a completely messed up image, as you ca see.

‘Original’ picture:

Scale input form (I just set an x value, the y is kept linked):
Screenshot_form

After the scale is executed:

Now, I’ve made many different attempts and I can definitely conclude that this is reproducible.
All the attempts were performed on 4 different setup:

  • Ubuntu 16.04 running on a desktop (attached screenshots)
  • Fedora 28 running on a desktop
  • CentOS7 running in a VirtualBox 5.2.22 VM (with guest additions)
  • Ubuntu 18.04 running on a laptop

In all the 4 of them, it happened as follows, quite consistently (this description is actually a summary, I really tried a lot of different things).

I’ve tried with jpeg 8bit and tif 16bit files. When I resize a jpg, the outcome is a completely white image (sometimes with random black pixels around).
When I try to resize an RGB image, the scale works as expected, it doesn’t matter which interpolation I try.
But if I convert the image to grayscale before resizing (Image → Mode → Grayscale), then I see exactly the same wrong behaviour of the scale tool.
Moreover, if I convert the grayscale image (e.g. the one in the screenshots above) to RGB before resizing, then the scale works as expected, with every interpolation.

Interestingly, if I try to scale to a ‘not too much smaller’ dimension, compared to the starting one, everything works perfectly. For instance, if the image above (~3500 pixel on the long side) is scaled to ~3000 pixel on the long side, then I don’t see any problem.

Please note, I’ve tried only with the appimage from @Carmelo_DrRaw (linked in this post: GIMP 2.10.8 is now out. - #3 by Carmelo_DrRaw), I don’t know then if it’s a bug of GIMP or of the package (that’s why I posted here before filing a bug report).

Conclusions:

  • It seems that grayscale images can’t be correctly resized with the ‘Cubic’ interpolation. The other interpolation method, however, seem to work correctly.
  • If the image is converted to RGB before resizing, then also the ‘Cubic’ interpolation works
  • No issue was found on RGB images; however, if an RGB image is converted to grayscale before converting, then the outcome is not correct.
  • It seems that this issue comes out when trying to rescale toward a dimension smaller than the half (long side) of the original image.

I’m available for further testing upon request. I can also provide the images that I’ve used, but I guess any grayscale image would do (while testing on different environments I basically just picked whatever picture I could find around; I also downloaded the Appimage every time).

bill

Further experiments might prove me wrong, but I tend to believe this issue does not come from the AppImage itself…

Hmm, I’ll do a quick check using GIMP 2.10 from git master.

Yes, rescaling a 3906x2602 16-bit integer grayscale down to 1000px on the long side using Cubic produced a solid white image, and same with 32f. But resizing to 2000px on the long side produced expected results - didn’t check any other combinations. So confirmed on Linux.

@billznn - would you be willing to file a bug report?

2 Likes

Yes, sure.
But I don’t have a lot of experience about it (never filed a bug in GIMP, in particular).

I can also test on Windows, if there’s a packaged GIMP I can use.

However, let me know the best way to do it and what to collect.
If I have to use something else that the Appimage it may take me a bit longer (busy period…).

BTW, do I need an account on GitLab (since I don’t have one yet…)?

Hi @billznn - this page is pretty good on how to report a bug:

The above page has a handy “search for bugs that might be the same” and if you type in “cubic”, nothing relevant comes up. So a new bug report is totally needed.

The above page also has a link to this page:

Which has an excellent overview of how to make a bug report that can help the devs pinpoint what the problem is. Step 3 talks about making a gitlab account.

If it’s a bug in Linux, it would be a miracle if the same problem didn’t also happen in Windows. And even if it doesn’t happen in Windows, it still needs to be fixed in Linux, so personally I wouldn’t bother testing in Windows until it’s been fixed in Linux. Well, personally I don’t test in Windows at all, haven’t used Windows in a long time.

@billznn - thanks very much! for making a bug report and also for checking here to confirm whether it’s really a bug in GIMP or perhaps in the AppImage, which as @Carmelo_DrRaw noted wasn’t all that likely but you never know.

1 Like

Thanks for the help.
The bug has been reported: https://gitlab.gnome.org/GNOME/gimp/issues/2626

As a natter of fact, this problem seems not to be the case in Windows.

I had installed the latest GIMP 2.10 release on the Windows machine where I do my scanning and tried the same rescaling tests with grayscale images, and everything seems to work as expected there.

Does this help in fixing it?
I’ll add this bit of info to the bug report, for starter.

Converting to mode=RGB eliminates this issue in my test. It seems to effect sRGB from what I can see.

Yes, I confirm. I also wrote it in the bug report.

Same image rescaled in Gimp 2.10.8 using Otto’s PPA exhibits normal behavior in sRGB as apposed to AppImage.

Not sure where the blame is here…

No problem here (16 bits bw image, Gimp 2.10.8, Manjaro 18.0.0)

Works for me (with NoHalo or Cubic), Gimp 2.10.8 “flatpak” on Ubuntu 16.04.