-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Parameters for extract are ordered unintuitively #276
Comments
Hej Andreas, The underlying vips_extract_area method accepts Perhaps the @brandonaaron originally implemented the much-requested |
That could be a fair compromise, except that none of the methods with similar purposes take options objects ( I'm mostly concerned with the long time effects of having the weirdly ordered |
It seems really obvious after reading this that it should definitely be in that order. At the time I didn't think much of it. I just followed the example api laid out in this comment without really thinking about it. Another potential name for a replacement is |
Thank you both and sorry for not spotting this anomaly with In the current API, methods refer to both the what and the how. Switching to fewer methods (the what) that accept a related Object of parameters (the how) will more closely match libvips and should hopefully help expose more of its features. I realise this might make things inconsistent, at least in the short term. Breaking API changes are also under discussion at #241 - please do get involved there too. |
Added support for the options object over at #308 as that seems to be the pragmatic solution. Closing this issue. |
Fix extract calls (lovell/sharp#276)
@lovell: "it was entirely my fault!"
The other day I spent a long time wondering why I couldn't get
extract
to do the right thing, only to find out that it wantstop
,left
,width
,height
, whereas I intuitively putleft
,top
,width
,height
. It works according to the documentation and all, but somehow I just assumed it would be X-Y-X-Y, and certainly not Y-X-X-Y.I realize it'd be a hard thing to change, but I just wanted to check whether it's intentional? And if it's not, I move that
extract
is deprecated in favor of a differently named method that takes the parameters in the "correct" order ;). Mostly to save new users from the gotcha.The text was updated successfully, but these errors were encountered: