Skip to content
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

Different captured image format #522

Closed
ArcaNO93 opened this issue Oct 29, 2024 · 10 comments · Fixed by #527
Closed

Different captured image format #522

ArcaNO93 opened this issue Oct 29, 2024 · 10 comments · Fixed by #527

Comments

@ArcaNO93
Copy link

ArcaNO93 commented Oct 29, 2024

Hello there
Does Roborazzi support capturing\comparing in other formats rather than PNG (i have a particular interest in webp since it is lighter)?
Thanks

@ArcaNO93 ArcaNO93 changed the title Different capture image format Different captured image format Oct 29, 2024
@takahirom
Copy link
Owner

takahirom commented Oct 30, 2024

Thanks. We might need to use the lossless format of WebP if we implement it. We should investigate whether it's compatible with platforms like Mac, Windows, and Linux.
For now, you can try using RGB565 for size reduction.

@ArcaNO93
Copy link
Author

ok thanks
i guess for now its possible just to convert everything from png to webp before comparing and after recording via custom gradle task

@takahirom
Copy link
Owner

I am working on this.

@takahirom
Copy link
Owner

As I expected, handling the WebP format differences could be challenging. We might need to consider using a lossless format.
image

@ArcaNO93
Copy link
Author

yeah id say lossless would do

@takahirom
Copy link
Owner

I'm considering releasing a feature that allows users to save images in their preferred format. However, there are some challenges. Roborazzi compares a new image with a previously saved one, which means that if the saved image is compressed (e.g., in a format like WebP), image differences might occur, as I mentioned. You can suppress these differences by using high maxDistance values, along with hShift and vShift, to manage this. If you prefer a lossless format, you can provide your own image writer through IIORegistry, a feature in Java, although this approach might be slightly complex.

Another way to address this issue is by offering save BufferedImage and load BufferedImage listeners to users. However, this is a JVM-specific approach, which could be implemented as a platform-specific class within the platform source set like this.
image

For now, I’m leaning towards implementing the feature that allows users to save images in their preferred format, as I initially mentioned.

@takahirom
Copy link
Owner

I apologize for frequently changing my opinion 😅. I will support lossless WebP, and you can customize both the image writer and loader as previously mentioned.
#529

@takahirom
Copy link
Owner

@ArcaNO93 If you have time, could you please review this PR?
#529

@ArcaNO93
Copy link
Author

ArcaNO93 commented Nov 5, 2024

oh, ofc

@ArcaNO93
Copy link
Author

ArcaNO93 commented Nov 5, 2024

left one comment @takahirom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants