libvips / nip2

A spreadsheet-like GUI for libvips.
https://libvips.github.io/libvips/
GNU General Public License v2.0
360 stars 13 forks source link

Gaussian noise preview, somewhat mixed up preview oddety. (Old + Win:XP) #60

Closed MvGulik closed 7 years ago

MvGulik commented 7 years ago

Some odd (and old) image-preview behavior (to me) on Gaussian noise generated image(s). (A minor issue at best. Don't mind knowing what might be triggering this (if known and its not to technical).)

When previewing a Gaussian noise generated image in nip2 (when not using a power of 2 zoom level) the preview image shows a bit mixed up preview. Image: example that nicely show the odd bands. capture_01232017_200350

Nip2: 8.4.0 (Not tested on older versions, but I have seen this before a long time ago.) OS: Win:XP

jcupitt commented 7 years ago

Oh dear! Yes, seen on linux as well. I'll investigate.

jcupitt commented 7 years ago

It's only a half-bug, I think. The gaussnoise operator generates random pixels every time it is called, so if a pixel is generated more than once (as it can be on zoomed tile overlaps), you'll see different answers.

To fix this, gaussnoise should make a single random seed for the whole when it starts up, then use the (x, y) coordinate plus that seed to make a number for a pixel. I'll make an issue on the libvips tracker.

Thanks for reporting this!

MvGulik commented 7 years ago

Roger. Thanks for explanation.

jcupitt commented 7 years ago

OK, fixed! Thank you very much for pointing this out. The fix will be in 8.5, due in March 2017.

MvGulik commented 7 years ago

PS: Seeing the "plus a per-call" part, I think that also changes/fixes a none intuitive exception I spotted on multiple Gaussian-pattern usage.

Merging 3 Gaussian patterns, with identical settings, will probably now also generate a colored image instead of a (virtual) gray scaled image.

Correct ?

Better to ask now I think.

jcupitt commented 7 years ago

I tried a tiny Python program:

#!/usr/bin/env python

import sys

import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips

r = Vips.Image.gaussnoise(100, 100)
g = Vips.Image.gaussnoise(100, 100)
b = Vips.Image.gaussnoise(100, 100)

im = r.bandjoin([g, b])

im = im.copy(interpretation = "srgb")

im.write_to_file(sys.argv[1])

And it makes this image:

x

So it looks like noise on an old analogue colour TV.

You're right though, try that in nip2 and you'll see a plain grey image. I'll try to fix that too.

MvGulik commented 7 years ago

Roger.

In that case ... I can't resist giving it its own ticket.