Resize, resample or limit image attachment size on issues #14616

Open
opened 2025-11-02 11:17:42 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @joshbmarshall on GitHub (Jun 18, 2025).

Feature Description

Some people insist on adding screenshots to an issue, and often these are quite large, png images.

It would be great if we can limit the size of these attached images.

Either by a hard kb limit, or by automatically reformatting to webp / reducing the image width or height (or all three)

Screenshots

No response

Originally created by @joshbmarshall on GitHub (Jun 18, 2025). ### Feature Description Some people insist on adding screenshots to an issue, and often these are quite large, png images. It would be great if we can limit the size of these attached images. Either by a hard kb limit, or by automatically reformatting to webp / reducing the image width or height (or all three) ### Screenshots _No response_
GiteaMirror added the proposal/acceptedtype/proposal labels 2025-11-02 11:17:42 -06:00
Author
Owner

@lunny commented on GitHub (Jun 18, 2025):

There is already some setting for attachments size and numbers. https://docs.gitea.com/administration/config-cheat-sheet#issue-and-pull-request-attachments-attachment

@lunny commented on GitHub (Jun 18, 2025): There is already some setting for attachments size and numbers. https://docs.gitea.com/administration/config-cheat-sheet#issue-and-pull-request-attachments-attachment
Author
Owner

@silverwind commented on GitHub (Jun 18, 2025):

I guess more fine-grained config options could be added specific to attached images, like attachments.MAX_IMAGE_SIZE=10 (10MB) and apply it to all attachments with mime-type image/*.

@silverwind commented on GitHub (Jun 18, 2025): I guess more fine-grained config options could be added specific to attached images, like `attachments.MAX_IMAGE_SIZE=10` (10MB) and apply it to all attachments with mime-type `image/*`.
Author
Owner

@joshbmarshall commented on GitHub (Jun 18, 2025):

awesome thank you. I've just disabled uploading anything just for now. But would be fabulous if there was a way to perhaps recode to webp or resample.

Similar to how when you take a photo into Telegram it resizes it to save on bandwidth

@joshbmarshall commented on GitHub (Jun 18, 2025): awesome thank you. I've just disabled uploading anything just for now. But would be fabulous if there was a way to perhaps recode to webp or resample. Similar to how when you take a photo into Telegram it resizes it to save on bandwidth
Author
Owner

@silverwind commented on GitHub (Jun 18, 2025):

If golang can do such image recoding natively, it may be feasible to add. Stuff like that is often only available only as C/C++, and we certainly won't be adding another CGO dependency for that.

@silverwind commented on GitHub (Jun 18, 2025): If golang can do such image recoding natively, it may be feasible to add. Stuff like that is often only available only as C/C++, and we certainly won't be adding another CGO dependency for that.
Author
Owner

@silverwind commented on GitHub (Jun 18, 2025):

Also, I'm not sure if such lossy transformation is actually a good idea. I think it's preferable to make the author decide, or at least make the author opt-in to such transformations.

@silverwind commented on GitHub (Jun 18, 2025): Also, I'm not sure if such lossy transformation is actually a good idea. I think it's preferable to make the author decide, or at least make the author opt-in to such transformations.
Author
Owner

@joshbmarshall commented on GitHub (Jun 18, 2025):

Makes sense. In my situation the author is non-technical and just hits screenshot and paste, so the image is a png.

If it was to be made opt in, would be good to have a setting for the default. ie opt in or opt out as the alternate choice.

@joshbmarshall commented on GitHub (Jun 18, 2025): Makes sense. In my situation the author is non-technical and just hits screenshot and paste, so the image is a png. If it was to be made opt in, would be good to have a setting for the default. ie opt in or opt out as the alternate choice.
Author
Owner

@silverwind commented on GitHub (Jun 18, 2025):

Yes, maybe we could provide a UI like "This image is too large, please confirm to downsize it" when too large images are uploaded but it won't be straightfoward because result file size can't be known before the operation, so the operation may be needed to be ran multiple times until the size is satisfactory.

@silverwind commented on GitHub (Jun 18, 2025): Yes, maybe we could provide a UI like "This image is too large, please confirm to downsize it" when too large images are uploaded but it won't be straightfoward because result file size can't be known before the operation, so the operation may be needed to be ran multiple times until the size is satisfactory.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14616