Re: pngcairo terminal: "crop" does different things if background color is specified

Ethan A Merritt <[email protected]> Mon, 28 Nov 2022 22:55:34 -0800
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <CALUAmEt-LC53V0ur7egwEY41r3NDb1EJJ4_skZxKkQpajb2hhw@mail.gmail.com>
On Monday, 28 November 2022 21:52:19 PST Dima Kogan wrote:
> Hi. I'm using a recent gnuplot shipped in Debian, and I'm seeing an odd
> behavior.
>
> I make a trivial .png plot like so:
>
>   set terminal pngcairo size 1024,768 notransparent crop
>   set output "/tmp/tst.png"
>   plot x
>
> Because of the "crop", the resulting image size is a bit smaller than
> requested. "file /tmp/tst.png" says:
>
>   tst.png: PNG image data, 995 x 751, 8-bit/color RGB, non-interlaced
>
> Not entirely sure why it's cropping anything here, but that's how it is.

It crops all whitespace around the edges, so of course it is smaller.


> But if I change the background color by adding to the end of the "set
> terminal" command:
>
>   background "#e8dfd0"
>
> then I get a full 1024x768 image. This shouldn't happen: the background
> color should not be doing anything to the image size.

True.  The current code seems to only test for transparent/non-transparent.
It should also test for background/non-background.

That's a fixable bug specific to cairopng.

You could still clip by filtering the output through an external
tool like ImageMagick.


        Ethan


--
Ethan A Merritt
Biomolecular Structure Center,  K-428 Health Sciences Bldg
MS 357742,   University of Washington, Seattle 98195-7742


_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta