images
images copied to clipboard
Feature Request: Image Outline
Hi,
Just a feature request.
I think it would be really useful to have a coloured border. Would be a nice dynamic feature.
Great coding. :)
@kleisauke : Maybe add something like &border=9
for 9 pixels of border, or &border=9,6
where 9 is top/bottom and 6 is left/right (like CSS).
I think it would just add to the image dimension? So &w=300 with &border=9 would be 318 pixels wide.
This is a slippery slope, then you'll want a param &boxSizing=borderBox
to ensure that w=300
with a border=9
stays 300 (sarcasm, don't worry.)
I think for most implementations of the API, CSS (web) or native-level borders (native) can be added by users; blurring, masking, etc., are great image serving CDN but I think borders might be going overboard. Next feature request will be shadows, otherwise. 👐
That's true, let's give it some consideration. @garycarlyle : What would be the user case? Could you give an example of the result you'd like? For solid borders CSS seems to be more appropriate indeed.
Taking another look, and I still agree with @AnandChowdhary on this issue. But if there are any compelling user cases, let us know, and we will reconsider this!
Borders are very practical, particularly when dealing with screen shots, and they cannot be compared to shadows or other fancy things. I am really missing this feature.
A typical use case is posting screen shots on bulletin boards. If bulletin board background and screen shot background are in the same colour (very often both are white), you really want to add some border in order to separate posted picture from the rest of your post. And if you are a common user on a bulletin board, you probably cannot tweak with CSS.
Yes, there are alternatives. For example, one can make a table with a single cell just to have a border around that cell. But on some bulletin boards tables may be unavailable, on some others they may be borderless, and on some others simply cumbersome in use. Even if you cannot use tables, you can always download a screenshot, add a border in some image editor, and re-upload it to a hosting service. Yes, that would work, but I thought avoiding it is one of the goals of this project.
I've provided a use case. Hence, I suggest re-opening this issue.
Regarding what new parameters are needed, border colour is enough for my use case. Border thickness is not critical, but won't hurt either, especially that users will surely look for it in docs. My suggestion is to support only these two options. Obviously, default setting should be no border. If border thickness is set but border colour is not, then it should be black. If border colour is set but thickness is not, then it should be 2px. Doesn't really matter if w=300
parameter would mean picture width including border or excluding it, but it would be good to document this.
Let's rediscuss this, as we now do have use cases.
Sorry I have not logged into this account for ages. Was really cool of you to consider this. I think my use case was when using images on a website in a scenario that you would want border but would be more practical doing it with this rather than CSS. I cant remember why I would have liked that rather than CSS but I must of had a reason. :) Actually @skalee seems to have covered what I think was on my mind at the time.
I'd be interested in this feature. I'm using weserv to generate circle GitHub avatars in a Github README, which is a case where I cannot use CSS (since Github strips it from <img>
tags). It would be cute to include a light grey border around the circle mask, similar to how Github itself displays circle avatars.
https://github.com/mmcloughlin/avo#adopters