feature request, concerning -trim in convert

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
RetroJ
Posts: 108
Joined: 2006-10-25T08:12:50-07:00

feature request, concerning -trim in convert

Post by RetroJ »

Hello,

My feature request is to be able to crop to the geometry that was the result of the last trim, with a single invocation of convert.

Anthony shows how to crop to the geometry of a trim via a subshell, at:

http://www.cit.gu.edu.au/~anthony/graph ... #trim_blur

Code: Select all

convert noisy.jpg -crop \
      `convert noisy.jpg -blur 0x10 -fuzz 15% -trim -format '%wx%h%O' info:` \
      +repage   noisy_trimmed_2.jpg

I had a situation where it would have been nice to be able to store the trim geometry and use it later in the same command. It was a case where I was generating both an ordinary image and mask image, in one convert command. Any changes to the size or page-offset of the ordinary image had to also be done to the mask image.

It is easy enough to use another approach to this problem, but I think this would be a useful feature.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: feature request, concerning -trim in convert

Post by anthony »

We are basically waiting for ideas and implementations that allow you to extrat info from images in memory, to use a arguments of later options.

Things like what can be extrasted from format. See IM Examples, future proposals...
http://www.imagemagick.org/Usage/bugs/future/#settings
Some steps have been made for extracting colors to report in -format strings, but as yet not into general arguments.

PS: -fill and -stroke can now be images for pattern tiles rather than colors, obsoleting the current use of -tile in convert. IM examples still needs updating for this.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
RetroJ
Posts: 108
Joined: 2006-10-25T08:12:50-07:00

Re: feature request, concerning -trim in convert

Post by RetroJ »

Ah, so there will be a variable-space implemented with the percent-sign syntax like that found in -format. I think that's an exellent idea, and I look forward to it.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: feature request, concerning -trim in convert

Post by anthony »

Yes, but it has problems in that argument handling currently does not have access to the current image sequence. And in an API there is no standard current image sequence, so it may only be command line based if at all.

The whole thing needs a lot of thought.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply