Skip to content

Add trim option to image processing and implement trimEdges function#441

Closed
vetler wants to merge 10 commits into
willnorris:mainfrom
vetler:feature/trim-edges
Closed

Add trim option to image processing and implement trimEdges function#441
vetler wants to merge 10 commits into
willnorris:mainfrom
vetler:feature/trim-edges

Conversation

@vetler
Copy link
Copy Markdown
Contributor

@vetler vetler commented Mar 28, 2025

Adds option "trim" to automatically trim edges of the same color.

Before, w/o trim option:

test_image

After, with /trim/ option in URL:
output

@vetler vetler changed the title add trim option to image processing and implement trimEdges function Add trim option to image processing and implement trimEdges function Mar 28, 2025
Copy link
Copy Markdown
Owner

@willnorris willnorris left a comment

Choose a reason for hiding this comment

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

This is really nicely done, thanks! I've added some comments below, some just optimizations for future. I'll take a look at trying to address this also, but wanted to go ahead and jot my notes down in case you get to it first.

Comment thread transform.go
Comment thread transform.go
Comment thread transform_test.go
@vetler vetler requested a review from willnorris March 30, 2025 19:43
@vetler
Copy link
Copy Markdown
Contributor Author

vetler commented Apr 8, 2025

I moved the trimming up to be the first transformation, as this makes more sense. If images are trimmed after scaling for instance, then the image will not be at expected size if it is trimmed.

@vetler
Copy link
Copy Markdown
Contributor Author

vetler commented Apr 16, 2025

@willnorris Are you waiting on anything more from me regarding this? Let me know if you think there's anything missing or any more tests that should be added

@willnorris
Copy link
Copy Markdown
Owner

@willnorris Are you waiting on anything more from me regarding this? Let me know if you think there's anything missing or any more tests that should be added

Not waiting on anything from you... just hadn't made the time to get back to look at this. Will try to do so later today.

@willnorris
Copy link
Copy Markdown
Owner

I combined the tests to into a single table-driven test function, and did some other very minimal cleanup. Merged as c361000. Thanks for this!

vetler added a commit to vetler/imageproxy that referenced this pull request Jul 15, 2025
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