Skip to content

Conversation

@glenntfung
Copy link
Contributor

If the user annotates a region outside of the image, the downloaded data will only reflect portions within the image.

If the user annotates a region outside of the image, the downloaded data will only reflect portions within the image.
@vercel
Copy link

vercel bot commented Aug 27, 2025

@glenntfung is attempting to deploy a commit to the Suman Kunwar's projects Team on Vercel.

A member of the Team first needs to authorize it.

@glenntfung glenntfung marked this pull request as ready for review August 27, 2025 21:18
@vercel
Copy link

vercel bot commented Aug 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
annotate-lab Ready Ready Preview Comment Aug 31, 2025 11:12pm

@sumn2u
Copy link
Owner

sumn2u commented Aug 28, 2025

Thanks for this PR. I was able to annotate beyond the image area and download the annotated coordinates. I think we need to prevent users from annotating outside the image on the client side.

Screenshot 2025-08-28 at 11 03 43 AM

The annotated co-ordinates.

1 0.763911 0.145161 0.301210 0.148387
1 1.000000 0.154032 0.000000 0.308065

@glenntfung
Copy link
Contributor Author

Thanks for this PR. I was able to annotate beyond the image area and download the annotated coordinates. I think we need to prevent users from annotating outside the image on the client side.

Screenshot 2025-08-28 at 11 03 43 AM The annotated co-ordinates.
1 0.763911 0.145161 0.301210 0.148387
1 1.000000 0.154032 0.000000 0.308065

Sure. Yes, my clamping logic only applies when the user intends to annotate something inside the image but accidentally drags the mouse outside. I will fix the client as well.

@glenntfung
Copy link
Contributor Author

Added a new commit; this should prevent the annotator from working beyond the image :)

@sumn2u
Copy link
Owner

sumn2u commented Aug 31, 2025

Added a new commit; this should prevent the annotator from working beyond the image :)

This is great, thanks. There seems to be a regression: the Masked Image and Annotated Image download functionality is not working.

Screenshot 2025-08-31 at 5 38 21 PM

@glenntfung
Copy link
Contributor Author

Added a new commit; this should prevent the annotator from working beyond the image :)

This is great, thanks. There seems to be a regression: the Masked Image and Annotated Image download functionality is not working.

Screenshot 2025-08-31 at 5 38 21 PM

Thanks for pointing out. I reverted the server change. With the updated client we don't need to do any data manipulation. This recovered Masked Image downloading. Annotated Image download does not work in the current master branch as I tested just now :(

@glenntfung
Copy link
Contributor Author

Added a new commit; this should prevent the annotator from working beyond the image :)

This is great, thanks. There seems to be a regression: the Masked Image and Annotated Image download functionality is not working.
Screenshot 2025-08-31 at 5 38 21 PM

Thanks for pointing out. I reverted the server change. With the updated client we don't need to do any data manipulation. This recovered Masked Image downloading. Annotated Image download does not work in the current master branch as I tested just now :(

Can you confirm this @sumn2u? I think we need another issue/PR for Annotated Image download if this is also the case on your machine as well, to keep things clean. If this is not the case, then it's my problem and I will try to find it out. Thanks!

@sumn2u
Copy link
Owner

sumn2u commented Aug 31, 2025

Added a new commit; this should prevent the annotator from working beyond the image :)

This is great, thanks. There seems to be a regression: the Masked Image and Annotated Image download functionality is not working.
Screenshot 2025-08-31 at 5 38 21 PM

Thanks for pointing out. I reverted the server change. With the updated client we don't need to do any data manipulation. This recovered Masked Image downloading. Annotated Image download does not work in the current master branch as I tested just now :(

Can you confirm this @sumn2u? I think we need another issue/PR for Annotated Image download if this is also the case on your machine as well, to keep things clean. If this is not the case, then it's my problem and I will try to find it out. Thanks!

The annotated image is working fine on my machine with recent changes. Did you first save the image and checked the box before downloading it?

Screenshot 2025-08-31 at 6 40 56 PM image_picker_33D0A721-94D1-49F9-9AD7-F4B5E52F616E-83633-0000205A0BF5312B 3

@glenntfung
Copy link
Contributor Author

I think things are fine now. The problem I had, but not you, should be due to the input image mode. I added a convert to the server so we might not have a problem. My test image was the A Lab's logo in the repo.

@sumn2u
Copy link
Owner

sumn2u commented Aug 31, 2025

I think things are fine now. The problem I had, but not you, should be due to the input image mode. I added a convert to the server so we might not have a problem. My test image was the A Lab's logo in the repo.

What do you think about checking the image mode first and then converting if necessary? This might prevent unnecessary conversions.

image = Image.open(BytesIO(response.content))
if image.mode != "RGBA":
   image = image.convert("RGBA")

@glenntfung
Copy link
Contributor Author

I think things are fine now. The problem I had, but not you, should be due to the input image mode. I added a convert to the server so we might not have a problem. My test image was the A Lab's logo in the repo.

What do you think about checking the image mode first and then converting if necessary? This might prevent unnecessary conversions.

image = Image.open(BytesIO(response.content))
if image.mode != "RGBA":
   image = image.convert("RGBA")

Yes! That's better. I did this.

Copy link
Owner

@sumn2u sumn2u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sumn2u sumn2u merged commit c3acdb6 into sumn2u:master Aug 31, 2025
5 checks passed
@sumn2u
Copy link
Owner

sumn2u commented Aug 31, 2025

Fixes #204

@sumn2u
Copy link
Owner

sumn2u commented Aug 31, 2025

Great work @glenntfung.

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 this pull request may close these issues.

2 participants