On Mon, Feb 25, 2019 at 07:21:02PM +0000, Alan Third wrote: > On Mon, Feb 25, 2019 at 05:36:46AM +0200, Eli Zaretskii wrote: > > > > It's indeed the clearing that bothered me, > > Would it be better if it was done by another XRender composite rather > than x_clear_area? I tried to replace this with XRenderFillRectangle, but realised I need to construct an XRenderColor struct, and I’ve no idea how to get the colour data held in img->background. I’ve attached a patch containing the original two, and the ability to crop. I decided to use a different order of processing from the ImageMagick code we have just now, as this new ordering seems more useful for the use cases that were suggested here. Imagemagick does resize ‐> crop ‐> rotate. I’ve gone with rotate ‐> crop ‐> resize. If that’s no good it’s simple enough to reorder the functions. The main issue I can foresee is that some people may prefer resize to come first, but I feel that reduces the usefulness of :max-width and :max-height. I’ve not yet documented crop, and it’s not already documented for Imagemagick. But in short: :crop '(width height left top) Where left and top can be negative to operate from the right and bottom of the image. Crop cannot be used to enlarge the image. As mentioned before, the crop occurs before the resize, so sizes are in terms of the original image, not the final one. -- Alan Third