all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Inverting command line session colours
@ 2019-02-08 15:01 Laura Lazzati
  2019-02-08 20:00 ` Gábor Boskovits
  0 siblings, 1 reply; 7+ messages in thread
From: Laura Lazzati @ 2019-02-08 15:01 UTC (permalink / raw)
  To: Guix-devel

Hi Guix!

I am having trouble inverting the colours of the command line session
videos. They should be black in the foreground with white text.
Gábor, I guess you solved that, could you remind me how you did it?
There was a link with -negate in convert but did not work for me.

Regards :)
Laura

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inverting command line session colours
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Gábor Boskovits @ 2019-02-08 20:00 UTC (permalink / raw)
  To: Laura Lazzati; +Cc: Guix-devel

Hello Laura,

> I am having trouble inverting the colours of the command line session
> videos. They should be black in the foreground with white text.
> Gábor, I guess you solved that, could you remind me how you did it?
> There was a link with -negate in convert but did not work for me.
>

Here is a command that works for me:

convert xyz.ps -background white -flatten -negate xyz.png

> Regards :)
> Laura

Best regards,
g_bor

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inverting command line session colours
  2019-02-08 20:00 ` Gábor Boskovits
@ 2019-02-08 22:53   ` Laura Lazzati
  2019-02-08 23:44     ` Björn Höfling
  0 siblings, 1 reply; 7+ messages in thread
From: Laura Lazzati @ 2019-02-08 22:53 UTC (permalink / raw)
  To: Gábor Boskovits; +Cc: Guix-devel

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-------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inverting command line session colours
  2019-02-08 22:53   ` Laura Lazzati
@ 2019-02-08 23:44     ` Björn Höfling
  2019-02-08 23:48       ` Laura Lazzati
  2019-02-09 10:55       ` Ricardo Wurmus
  0 siblings, 2 replies; 7+ messages in thread
From: Björn Höfling @ 2019-02-08 23:44 UTC (permalink / raw)
  To: Laura Lazzati; +Cc: Guix-devel


[-- 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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inverting command line session colours
  2019-02-08 23:44     ` Björn Höfling
@ 2019-02-08 23:48       ` Laura Lazzati
  2019-02-09 10:55       ` Ricardo Wurmus
  1 sibling, 0 replies; 7+ messages in thread
From: Laura Lazzati @ 2019-02-08 23:48 UTC (permalink / raw)
  To: Björn Höfling; +Cc: Guix-devel

Go to bed Bruno :) I will be writing another mail, and answer back
this one. but go to bed! your intern will tell Sage, you have to
recover from your cold.
On Fri, Feb 8, 2019 at 8:44 PM Björn Höfling
<bjoern.hoefling@bjoernhoefling.de> wrote:
>
> 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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inverting command line session colours
  2019-02-08 23:44     ` Björn Höfling
  2019-02-08 23:48       ` Laura Lazzati
@ 2019-02-09 10:55       ` Ricardo Wurmus
  2019-02-09 12:12         ` Laura Lazzati
  1 sibling, 1 reply; 7+ messages in thread
From: Ricardo Wurmus @ 2019-02-09 10:55 UTC (permalink / raw)
  To: Björn Höfling; +Cc: Guix-devel


Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:

> 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.

My guess is that it doesn’t work the first time around because the
background is in fact transparent.

I recommend not to waste time on this as colour management will be
overhauled eventually anyway.  With the use of Pango markup to specify
text colours you probably don’t want to invert the colours.

-- 
Ricardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inverting command line session colours
  2019-02-09 10:55       ` Ricardo Wurmus
@ 2019-02-09 12:12         ` Laura Lazzati
  0 siblings, 0 replies; 7+ messages in thread
From: Laura Lazzati @ 2019-02-09 12:12 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

Hi!
Thank you Bruno for helping.
> Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:
>
> > Conclusion: As a quick workaround, you can add another pipe and use
> > convert twice
I also tried with your example and made it work in my Makefile. BUT
the typography kind of changed Weird again, Stayed up late trying to
solve it.

> I recommend not to waste time on this as colour management will be
> overhauled eventually anyway.  With the use of Pango markup to specify
> text colours you probably don’t want to invert the colours.
Ok, great! Thank you, will switch to another task then :)

Regards :)
Laura

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-02-09 12:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-02-08 23:48       ` Laura Lazzati
2019-02-09 10:55       ` Ricardo Wurmus
2019-02-09 12:12         ` Laura Lazzati

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.