Open florianbepunkt opened 3 years ago
This is definetly on my TODO list for things i want to implement, as I also need this for OSnap. This does need to wait until #47 is merged though.
It would be great to have this feature. I'm personally interested in it because I would like to use odiff
instead of pixelmatch
in @web/test-runner-visual-regression
.
I am currently on my way to implement this.
Sadly I had to take a detour to fix some Windows issues (which hopefully get resolved in the next few days).
Thanks for letting me know. For now I've tried to write files as a workaround and it works, here is an example. If possible, it would be great to also get the diff image as a buffer, so that we could write it separately.
Hello, any news on this one? We would like to integrate this into our puppeteer workflow, where we are currently using pixelmatch.
Unfortunately no news, need to sit and implement a feature from scratch, if you have interest in trying this out – feel free to open a PR
Maybe I will get around checking this out. Any info to point me in the right direction?
The idea is simple but implementation may be a bit tricky especially for C part. We need to accept stdin buffer with an encoded image, then decode it in memory and everything else odiff already has implemented.
(there is no reason to support raw images because there would be not so much benefit)
Ok, yes sounds simple. But I am afraid I have no knowledge of OCAML or Reason. I will therefore probably not be able to help out.
I’ve been thinking about this but in fact I can not understand benefit of using especially buffer in your case.
You are getting encoded image from puppeteer it means that browser already made some work on encoding it. Why not to write the image in file system and after use odiff? You will be able to also provide screenshots as test artifacts after.
We would save IO time I guess. But at least we could try to use the filesystem.
You still want to produce the base as artifact I assume
As mentioned above, I'm also interested in this feature. You can find our plugin source code here:
pixelMatchDiff
helper that compares two images,I'm not sure about potential IO gains but supporting Buffer would make things simpler for us.
@dmtrKovalenko I am also using a buffer io for pngs in osnap.
https://github.com/eWert-Online/OSnap/blob/master/lib/OSnap_Diff/ReadPng.c
I would be able to work on "upstreaming" it if you are interested. I don't know if (and how well) the other io libraries are supporting buffers as input though.
Wow that is really cool, we can leverage this as well, thanks Torben!
any progress on this?
@jasan-s there is a pr partially open but a bit abandoned. Any help or new PR is welcoem
I'm trying to integrate odiff into a third-party lib. It would be great if the compare function would also accept buffers instead of paths. This would save the round trip to write a buffer to disk in some use cases.