GdkPixbuf => 100%



I'm not sure what's going on but I am unable to debug due Segment fault in debugging mode.

All I need to do is to scale an image in order to make it fit into a dialog (like an image preview)

However, as soon as I

```gjs
pixbuf = GdkPixbuf.Pixbuf.new_from_file(validImageAbsPath)
```

the CPU reached 100% and there's no way to make it stop.
I've tried to get rid of the reference count doing this after

```gjs
pixbuf = Gtk.Image.new_from_pixbuf(pixbuf.scale_simple.apply(
            pixbuf,
            this.calucalteSize(
              screen,
              pixbuf,
              margin
            ).concat(
              GdkPixbuf.InterpType.BILINEAR
            )
          ));
```
and while the image works, after a little while it's shown the app crashes (doing literally nothing else)


I've noticed that this does not instantly happen if the image is a small one, but as soon as I use 4K images the app crashes each time.

I couldn't find much documentation and all I can guess is that maybe I am missing something, like an initialization?
https://developer.gnome.org/gdk-pixbuf/2.34/gdk-pixbuf-gdk-pixbuf-Xlib-initialization.html

Or maybe GdkPixbuf is known to be somehow problematic via GJS (or everywhere) ?

Is there any alternative to create a resized image from a local file, without using a spawned program on the background to do this?

Thanks

P.S. it's being actually fun to work with jsgtk and a Twitter client. If curious, have a look:
https://github.com/WebReflection/jsgtk-twitter








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]