Re: How do I get the offset result from "-trim"?

Adam Richter <[email protected]> Fri, 14 Aug 2020 01:50:45 -0700
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <CAGn-Tgh9vU6X2CSgwbDDa5PUMHdPdPmPdUqLJr0bcc2F1R388A@mail.gmail.com>
On Thu, Aug 13, 2020 at 9:28 AM Bob Friesenhahn
<[email protected]> wrote:
[...]
> This does feel like a bug to me.  I get a similar result here:
>
> % gm convert covid-19.tif -fuzz 0.5 -trim -format '%O' info:-
> +0+0
>
> There are likely implications if/when the bug is fixed since it may
> influence the results of other algorithms.

Thanks for such a prompt response, Bob.

I have found a workaround: add "-format %@" and remove "-trim", for example:

$ gm convert -fuzz 20% -format "%@" 001_bordered.pnm info:-
2617x3328+2+2,

By the way, ImageMagick and GraphicsMagic gave me different bounding
boxes when I used "-fuzz 30%":

$ magick convert -fuzz 30% -format "%@\n" 001_bordered.pnm info:-
2409x2837+119+133
$ gm convert -fuzz 30% -format "%@" 001_bordered.pnm info:-
2572x3199+22+2

I don't know if that matters or if one is right and the other is
wrong.  I am guessing that this is some different between
GraphicsMagick's
FuzzyColorMatch() and ImageMagick.  Anyhow, it is not a problem for
me, but I figure I ought to pass along this additional observation
in case it is of any interest.

Although the issue is no longer causing me a problem, please feel free
to let me know if I can be of assistance in any way if you decide to
dig into this issue further now or in the future.

Adam