[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inverting command line session colours

From: Björn Höfling
Subject: Re: Inverting command line session colours
Date: Sat, 9 Feb 2019 00:44:21 +0100

Hi Laura,

this kept me awake, I had to open my laptop again :-)

On Fri, 8 Feb 2019 19:53:50 -0300
Laura Lazzati <address@hidden> wrote:

> Hi!
> > convert -background white -flatten -negate xyz.png  
> I had already tried the -negate before but didn't work, I only got
> full white pngs (the text turned white)
> I am running  imagemagick    6.9.10-14 this is the rule:
> -------------starts----------------
> (VIDEO)/$(LOCALE_LANG)/out/$(SESSION)-%.png:
> $(VIDEO)/$(LOCALE_LANG)/out/$(SESSION)-%.txt
>     tail -n 20 $< | \
>     paps --landscape --columns=80 --font "Monospace 20" | \
>     convert -density 128 \
>             -fill black \
>             -background white \
>             -flatten \
>             -rotate 90 \
>             -delete 0--2 - $@
> -------ends-------------------

I can confirm this problem, let's track it down the Guix way:

## Make sure we are really talking about the same, getting into a fresh
container of latest guix:

# To make sure you are at the same commit where I tested this, you
could do a:
$ guix pull --commit=307182d4f7b1a56e220f208ad5f886e7784db115

$ guix describe
Generation 46   Feb 08 2019 23:58:31    (current)
[.. other channels here ..]
  guix 307182d
    repository URL:
    branch: master
    commit: 307182d4f7b1a56e220f208ad5f886e7784db115

$ cd /tmp
$ mkdir tst
$ cd tst
# really get into a container, to be extra sure!
/tmp/tst$ guix environment -C --ad-hoc coreutils less imagemagick paps

$ convert -version
Version: ImageMagick 6.9.10-14 Q16 x86_64 2018-11-14
Copyright: © 1999-2018 ImageMagick Studio LLC
Features: Cipher DPC OpenMP 
Delegates (built-in): bzlib fftw fontconfig freetype gvc jng jpeg lcms lzma 
pangocairo png tiff x xml zlib

# Create a postscript file we can work with:
$ echo "Hello, World!" | paps --landscape --columns=80 --font "Monospace 20" >

# This output looks good, white background, black text:
cat| convert -density 128 -fill black -background white -flatten 
-rotate 90 -delete 0--2 - out.png

# Though I'm getting this warning, is that the problem?:
# convert: profile 'icc': 'RGB ': RGB color space not permitted on grayscale 
PNG `out.png' @ warning/png.c/MagickPNGWarningHandler/1667.

# This produces only whiteness:
# Same warning as above:
cat| convert -density 128 -fill black -background white -flatten 
-rotate 90 -delete 0--2 -negate - out-negated.png

#But at least this works afterwards: White text on black background:
convert out.png -negate outout.png

Conclusion: As a quick workaround, you can add another pipe and use
convert twice.

But there should be a way to do it in one way. ImageMagick is a bit
tricky in that. I have no idea for now.

As reference, I'm attaching my output files.


Description: PostScript document

Attachment: out.png
Description: PNG image

Attachment: out-negated.png
Description: PNG image

Attachment: outout.png
Description: PNG image

Attachment: pgpaEnjIqytED.pgp
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]