-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gifsave output is in grayscale in Avalonia desktop app while is colored as console app without Avalonia package #185
Comments
Was this tested on Linux? Are you able to provide a standalone code sample that exhibits this behavior? It might possibly collide with the A simple way to sanity check this is to enable libvips' internal mechanism to track and debug reference counts. It can be enabled with the |
This should not be a issue, at least for C-programs. See for example: test.c#include <stdio.h>
#include <vips/vips.h>
int main(int argc, char **argv) {
VipsImage *in;
double mean;
VipsImage *out;
if (VIPS_INIT(argv[0]))
vips_error_exit(NULL);
if (argc != 3)
vips_error_exit("usage: %s infile outfile", argv[0]);
vips_leak_set(TRUE);
if (!(in = vips_image_new_from_file(argv[1], NULL)))
vips_error_exit(NULL);
printf("image width = %d\n", vips_image_get_width(in));
if (vips_avg(in, &mean, NULL))
vips_error_exit(NULL);
printf("mean pixel value = %g\n", mean);
if (vips_invert(in, &out, NULL))
vips_error_exit(NULL);
g_object_unref(in);
if (vips_image_write_to_file(out, argv[2], NULL))
vips_error_exit(NULL);
g_object_unref(out);
vips_shutdown();
return 0;
} $ mkdir linux-x64
$ curl -fsSL https://github.com/kleisauke/libvips-packaging/releases/download/v8.13.2/libvips-8.13.2-linux-x64.tar.gz | tar xzC linux-x64
$ gcc -O3 -Ilinux-x64/include -Ilinux-x64/include/glib-2.0 -Ilinux-x64/lib/glib-2.0/include test.c -Llinux-x64/lib -l:libvips.so.42 -Wl,-rpath=\$ORIGIN/linux-x64/lib
$ readelf -Wd a.out | grep 'RPATH'
0x000000000000000f (RPATH) Library rpath: [$ORIGIN/linux-x64/lib]
$ ./a.out zebra.jpg x.jpg
image width = 4120
mean pixel value = 96.8319
memory: high-water mark 41.81 MB
$ LD_PRELOAD="/lib64/libgobject-2.0.so.0" ./a.out zebra.jpg x.jpg
image width = 4120
mean pixel value = 96.8319
memory: high-water mark 41.62 MB
$ LD_DEBUG=bindings LD_PRELOAD="/lib64/libgobject-2.0.so.0" ./a.out zebra.jpg x.jpg 2>&1 | grep "a.out .* to /lib64/libgobject-2.0.so.0"
3870775: binding file ./a.out [0] to /lib64/libgobject-2.0.so.0 [0]: normal symbol `g_object_unref'
$ readelf -Wd linux-x64/lib/libvips.so.42 | grep 'FLAGS\|RPATH'
0x000000000000000f (RPATH) Library rpath: [$ORIGIN/]
0x000000006ffffffb (FLAGS_1) Flags: NODELETE That said, I'm not sure if this also applies to C#. |
I managed to find some time today to create a reproduce repo. https://github.com/lanyusan/net-vips-avanolia-bug Please select the folder Output is written to For debugging I have also written joined frames before gifsave to output folder. Thanks for your attention. |
@kleisauke
So I guess it has something to do with the encoding of composited frames, either my code needs to take care of or it is something gifsave needs to take care of. I have created a branch Obviously it is preferrable I don't have to do the above calls. Thanks. |
Fixed with PR libvips/libvips#3213. It'll be in libvips 8.14, due RSN. |
A release candidate of NetVips.Native v8.14.0 is now available for testing. |
NetVips v2.3.0 and NetVips.Native v8.14.2 is now available. |
Hi,
I have encountered a very strange problem.
I have an inhouse tool for generative art. In console mode without Avalonia all works great.
Now we are developing a desktop app with Avalonia, the same code generated gif output in grayscale.
Would it have something to do with conflicts in some shared libs with Avalonia?
For debugging I have generated each frame in png and also the concatenated multiple page image in png. All seem to be right.
It seems to be the problem with that last
gifsave
call. Not sure why it happened.Here is the code:
And sample files:
each frame
![1 gif-0](https://user-images.githubusercontent.com/56706512/204179266-6b06eff0-d3a0-41dd-9157-3b3a4677c5b0.png)
![1 gif-1](https://user-images.githubusercontent.com/56706512/204179267-59fb14f1-aa1d-48e5-819b-4c1a8dbc5751.png)
![1 gif-2](https://user-images.githubusercontent.com/56706512/204179269-bf803d82-f80c-4797-9bac-bdec037dd96d.png)
joined frames in one png
![1 gif-joined](https://user-images.githubusercontent.com/56706512/204179273-0a613206-404c-4264-a6d0-f3c006718483.png)
generated gif with gifsave
![1](https://user-images.githubusercontent.com/56706512/204179279-46829699-a1f8-4827-b998-c6ecbee25cdd.gif)
The text was updated successfully, but these errors were encountered: