Re: Preventing -extent from converting to RGB

[email protected]
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
----- Toby Thain <[email protected]> wrote:
> On 2016-08-27 9:36 PM, [email protected] wrote:
> >
> > ----- Toby Thain <[email protected]> wrote:
> >> Hi,
> >>
> >> I have a grey scale source image and I am applying a -rotate and an
> >> -extent operation. I'm finding that the output is RGB, presumably
> >> because of the background colour? Is there any way of getting the
> >> equivalent of -extent without the RGB conversion? (I know I can add a
> >> -channel to go back to greyscale, but it seems superfluous.)
> >
> > Did you try making the background a grayscale colour?
> 
> That was my first thought too, but the doc only talks about RGB colours; 
> there was no obvious way to specify a single channel "colour." (Of 
> course there may be a way I missed.)

Try "-background white", "-background black", "-background '#a0a0a0'",
etc.  As long as all three components of the background color are
equal, it won't force GM to write an RGB image.

BTW I'm assuming you are writing a PNG, and working with the current
version of GM.

Glenn

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.