unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Björn Höfling" <bjoern.hoefling@bjoernhoefling.de>
To: Laura Lazzati <laura.lazzati.15@gmail.com>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Inverting command line session colours
Date: Sat, 9 Feb 2019 00:44:21 +0100	[thread overview]
Message-ID: <20190209004421.51d79015@alma-ubu> (raw)
In-Reply-To: <CAPNLzUOapS4TrHaizEyy27g0urRj4F7TpveCCOEXsNn_qLc9jw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2976 bytes --]

Hi Laura,

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

On Fri, 8 Feb 2019 19:53:50 -0300
Laura Lazzati <laura.lazzati.15@gmail.com> wrote:

> Hi!
> > convert xyz.ps -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: https://git.savannah.gnu.org/git/guix.git
    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 https://imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
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" > hello-world.ps

# This output looks good, white background, black text:
cat hello-world.ps| 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 hello-world.ps| 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.

Björn


[-- Attachment #1.2: hello-world.ps --]
[-- Type: application/postscript, Size: 10321 bytes --]

[-- Attachment #1.3: out.png --]
[-- Type: image/png, Size: 4213 bytes --]

[-- Attachment #1.4: out-negated.png --]
[-- Type: image/png, Size: 1185 bytes --]

[-- Attachment #1.5: outout.png --]
[-- Type: image/png, Size: 2079 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2019-02-08 23:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 15:01 Inverting command line session colours Laura Lazzati
2019-02-08 20:00 ` Gábor Boskovits
2019-02-08 22:53   ` Laura Lazzati
2019-02-08 23:44     ` Björn Höfling [this message]
2019-02-08 23:48       ` Laura Lazzati
2019-02-09 10:55       ` Ricardo Wurmus
2019-02-09 12:12         ` Laura Lazzati

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190209004421.51d79015@alma-ubu \
    --to=bjoern.hoefling@bjoernhoefling.de \
    --cc=guix-devel@gnu.org \
    --cc=laura.lazzati.15@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).