Re: How to setup image converters on Mac?

2017-10-03 Thread Stephan Witt
Am 03.10.2017 um 22:06 schrieb Kornel Benko :
> 
> Am Dienstag, 3. Oktober 2017 um 19:59:38, schrieb Stephan Witt 
> 
>> Am 02.10.2017 um 02:04 schrieb Kornel Benko :
>>> 
>>> Am Sonntag, 1. Oktober 2017 um 22:16:43, schrieb Stephan Witt 
>>> 
 Am 01.10.2017 um 10:20 schrieb Kornel Benko :
> 
> Am Sonntag, 1. Oktober 2017 um 06:59:51, schrieb Stephan Witt 
> 
>> Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
>>> 
>>> On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
>>> 
> But this is too complex for 2.3.0, IMO. So I’d put my patch in and
> let some nice guys change the splash files.
>>> 
>>> From what I understand, after your most recent patch is put in 2.3.x, we
>>> no longer need a patch for the splash files. Is that correct?
>> 
>> Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
>> I’m not sure if I need some feedback it doesn’t break the build on
>> other platforms. The Cmake build I've not extended too.
> 
> OK, so the only change for cmake would be to add maxima and inkscape to 
> the list of installed scripts?
 
 Yes, and no. Yes this is needed - but simple. The patch is there.
 
 The lyxconvert utility is not build with cmake.
 
 Stephan
>>> 
>>> I tried it at c2eb1a1, builds on linux.
>> 
>> Thanks. In principle on Mac it works too. The install target is
>> not as I’d expect it - but that doesn’t matter, ATM.
>> 
>> I’d propose to disable the build on linux. It shouldn't be installed there.
>> 
>> Stephan
> 
> OK, but note that building on linux was helpful to create the patch.
> Should it be disabled on Windows too? I cannot test this case.

Yes. Mac only.

Stephan

Re: How to setup image converters on Mac?

2017-10-03 Thread Kornel Benko
Am Dienstag, 3. Oktober 2017 um 19:59:38, schrieb Stephan Witt 
> Am 02.10.2017 um 02:04 schrieb Kornel Benko :
> > 
> > Am Sonntag, 1. Oktober 2017 um 22:16:43, schrieb Stephan Witt 
> > 
> >> Am 01.10.2017 um 10:20 schrieb Kornel Benko :
> >>> 
> >>> Am Sonntag, 1. Oktober 2017 um 06:59:51, schrieb Stephan Witt 
> >>> 
>  Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
> > 
> > On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
> > 
> >>> But this is too complex for 2.3.0, IMO. So I’d put my patch in and
> >>> let some nice guys change the splash files.
> > 
> > From what I understand, after your most recent patch is put in 2.3.x, we
> > no longer need a patch for the splash files. Is that correct?
>  
>  Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
>  I’m not sure if I need some feedback it doesn’t break the build on
>  other platforms. The Cmake build I've not extended too.
> >>> 
> >>> OK, so the only change for cmake would be to add maxima and inkscape to 
> >>> the list of installed scripts?
> >> 
> >> Yes, and no. Yes this is needed - but simple. The patch is there.
> >> 
> >> The lyxconvert utility is not build with cmake.
> >> 
> >> Stephan
> > 
> > I tried it at c2eb1a1, builds on linux.
> 
> Thanks. In principle on Mac it works too. The install target is
> not as I’d expect it - but that doesn’t matter, ATM.
> 
> I’d propose to disable the build on linux. It shouldn't be installed there.
> 
> Stephan

OK, but note that building on linux was helpful to create the patch.
Should it be disabled on Windows too? I cannot test this case.

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: How to setup image converters on Mac?

2017-10-03 Thread Scott Kostyshak
On Tue, Oct 03, 2017 at 06:36:03PM +, Stephan Witt wrote:
> 
> > Am 01.10.2017 um 06:59 schrieb Stephan Witt :
> > 
> > Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
> >> 
> >> On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
> >> 
>  But this is too complex for 2.3.0, IMO. So I’d put my patch in and
>  let some nice guys change the splash files.
> >> 
> >> From what I understand, after your most recent patch is put in 2.3.x, we
> >> no longer need a patch for the splash files. Is that correct?
> > 
> > Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
> > I’m not sure if I need some feedback it doesn’t break the build on
> > other platforms. The Cmake build I've not extended too.
> 
> I’ve cherry-picked change f93ec4a1f41b70a4607ff355e19f4721f9338028.
> The I made a distribution package and built it. The splash file 
> can be displayed and converted to pdf with it. So…
> 
> I’ve put it in now.

Great!

Thanks,

Scott


signature.asc
Description: PGP signature


Re: How to setup image converters on Mac?

2017-10-03 Thread Stephan Witt

> Am 01.10.2017 um 06:59 schrieb Stephan Witt :
> 
> Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
>> 
>> On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
>> 
 But this is too complex for 2.3.0, IMO. So I’d put my patch in and
 let some nice guys change the splash files.
>> 
>> From what I understand, after your most recent patch is put in 2.3.x, we
>> no longer need a patch for the splash files. Is that correct?
> 
> Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
> I’m not sure if I need some feedback it doesn’t break the build on
> other platforms. The Cmake build I've not extended too.

I’ve cherry-picked change f93ec4a1f41b70a4607ff355e19f4721f9338028.
The I made a distribution package and built it. The splash file 
can be displayed and converted to pdf with it. So…

I’ve put it in now.

Stephan

Re: How to setup image converters on Mac?

2017-10-03 Thread Stephan Witt
Am 02.10.2017 um 02:04 schrieb Kornel Benko :
> 
> Am Sonntag, 1. Oktober 2017 um 22:16:43, schrieb Stephan Witt 
> 
>> Am 01.10.2017 um 10:20 schrieb Kornel Benko :
>>> 
>>> Am Sonntag, 1. Oktober 2017 um 06:59:51, schrieb Stephan Witt 
>>> 
 Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
> 
> On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
> 
>>> But this is too complex for 2.3.0, IMO. So I’d put my patch in and
>>> let some nice guys change the splash files.
> 
> From what I understand, after your most recent patch is put in 2.3.x, we
> no longer need a patch for the splash files. Is that correct?
 
 Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
 I’m not sure if I need some feedback it doesn’t break the build on
 other platforms. The Cmake build I've not extended too.
>>> 
>>> OK, so the only change for cmake would be to add maxima and inkscape to the 
>>> list of installed scripts?
>> 
>> Yes, and no. Yes this is needed - but simple. The patch is there.
>> 
>> The lyxconvert utility is not build with cmake.
>> 
>> Stephan
> 
> I tried it at c2eb1a1, builds on linux.

Thanks. In principle on Mac it works too. The install target is
not as I’d expect it - but that doesn’t matter, ATM.

I’d propose to disable the build on linux. It shouldn't be installed there.

Stephan

Re: How to setup image converters on Mac?

2017-10-01 Thread Kornel Benko
Am Sonntag, 1. Oktober 2017 um 22:16:43, schrieb Stephan Witt 
> Am 01.10.2017 um 10:20 schrieb Kornel Benko :
> > 
> > Am Sonntag, 1. Oktober 2017 um 06:59:51, schrieb Stephan Witt 
> > 
> >> Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
> >>> 
> >>> On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
> >>> 
> > But this is too complex for 2.3.0, IMO. So I’d put my patch in and
> > let some nice guys change the splash files.
> >>> 
> >>> From what I understand, after your most recent patch is put in 2.3.x, we
> >>> no longer need a patch for the splash files. Is that correct?
> >> 
> >> Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
> >> I’m not sure if I need some feedback it doesn’t break the build on
> >> other platforms. The Cmake build I've not extended too.
> > 
> > OK, so the only change for cmake would be to add maxima and inkscape to the 
> > list of installed scripts?
> 
> Yes, and no. Yes this is needed - but simple. The patch is there.
> 
> The lyxconvert utility is not build with cmake.
> 
> Stephan

I tried it at c2eb1a1, builds on linux.

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: How to setup image converters on Mac?

2017-10-01 Thread Stephan Witt
Am 01.10.2017 um 10:20 schrieb Kornel Benko :
> 
> Am Sonntag, 1. Oktober 2017 um 06:59:51, schrieb Stephan Witt 
> 
>> Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
>>> 
>>> On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
>>> 
> But this is too complex for 2.3.0, IMO. So I’d put my patch in and
> let some nice guys change the splash files.
>>> 
>>> From what I understand, after your most recent patch is put in 2.3.x, we
>>> no longer need a patch for the splash files. Is that correct?
>> 
>> Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
>> I’m not sure if I need some feedback it doesn’t break the build on
>> other platforms. The Cmake build I've not extended too.
> 
> OK, so the only change for cmake would be to add maxima and inkscape to the 
> list of installed scripts?

Yes, and no. Yes this is needed - but simple. The patch is there.

The lyxconvert utility is not build with cmake.

Stephan

Re: How to setup image converters on Mac?

2017-10-01 Thread Kornel Benko
Am Sonntag, 1. Oktober 2017 um 06:59:51, schrieb Stephan Witt 
> Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
> > 
> > On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
> > 
> >>> But this is too complex for 2.3.0, IMO. So I’d put my patch in and
> >>> let some nice guys change the splash files.
> > 
> > From what I understand, after your most recent patch is put in 2.3.x, we
> > no longer need a patch for the splash files. Is that correct?
> 
> Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
> I’m not sure if I need some feedback it doesn’t break the build on
> other platforms. The Cmake build I've not extended too.

OK, so the only change for cmake would be to add maxima and inkscape to the 
list of installed scripts?

> Stephan

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: How to setup image converters on Mac?

2017-09-30 Thread Stephan Witt
Am 30.09.2017 um 20:15 schrieb Scott Kostyshak :
> 
> On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:
> 
>>> But this is too complex for 2.3.0, IMO. So I’d put my patch in and
>>> let some nice guys change the splash files.
> 
> From what I understand, after your most recent patch is put in 2.3.x, we
> no longer need a patch for the splash files. Is that correct?

Yes, it’s correct. I need to put it into 2.3.x after it’s in master.
I’m not sure if I need some feedback it doesn’t break the build on
other platforms. The Cmake build I've not extended too.

Stephan

Re: How to setup image converters on Mac?

2017-09-30 Thread Scott Kostyshak
On Wed, Sep 20, 2017 at 09:11:53PM +, Scott Kostyshak wrote:

> > But this is too complex for 2.3.0, IMO. So I’d put my patch in and
> > let some nice guys change the splash files.

From what I understand, after your most recent patch is put in 2.3.x, we
no longer need a patch for the splash files. Is that correct?

Scott


signature.asc
Description: PGP signature


Re: [PATCH] Re: How to setup image converters on Mac?

2017-09-24 Thread Enrico Forestieri
On Sun, Sep 24, 2017 at 12:24:26PM +0200, Stephan Witt wrote:
> 
> This is the solution I’d like to propose. It’s not tested on Linux and
> Windows.
> 
> The idea is to add imgconvert as fallback-converter for SVG to PDF and PNG to
> PDF.
> At the moment it uses the Qt library routines for image processing. I’ll plan
> to investigate how to integrate libcairo for real vector graphics conversion.
> 
> I’d like to hear your comments.

I think it is fine. However, I would avoid introducing 2 more converters
and instead I would modify convertDefault.py so that when imagemagick is
not installed the new imgconvert command is used.

In this way, whatever conversion between image formats supported by Qt
would succeed (without the need of new converter definitions).

-- 
Enrico


Re: [PATCH] Re: How to setup image converters on Mac?

2017-09-24 Thread Stephan Witt
Am 24.09.2017 um 12:24 schrieb Stephan Witt :
> 
> Am 21.09.2017 um 15:08 schrieb Stephan Witt :
>> 
>> Am 21.09.2017 um 14:54 schrieb Enrico Forestieri :
>>> 
>>> On Thu, Sep 21, 2017 at 11:43:29AM +0200, Stephan Witt wrote:
 
 My question (again): how can I circumvent this and configure „my“ converter
 so it’s used to convert the SVG to PNG and run pdflatex with the PNG 
 instead
 of the PDF (which would be rasterized anyway, when ImageMagick is used for
 SVG to PDF conversion).
>>> 
>>> Maybe you can use again Qt to convert the SVG to a rasterized PDF.
>>> See the attached example. Note that this is not actually limited
>>> to SVG but is able to convert to PDF any format natively understood
>>> by Qt (even if the original vector format is lost).
>> 
>> Thank you. That’s not the solution I’d expected. But of course I’ll try that.
>> I’d combine your code snippets into a single converter utility if it works.
>> 
>> I’ll keep you up-to-date. :)
> 
> This is the solution I’d like to propose. It’s not tested on Linux and 
> Windows.
> 
> The idea is to add imgconvert as fallback-converter for SVG to PDF and PNG to 
> PDF.
> At the moment it uses the Qt library routines for image processing. I’ll plan
> to investigate how to integrate libcairo for real vector graphics conversion.
> 
> I’d like to hear your comments.
> 
> Stephan
> 
> <0001-imgconvert.patch>

Sorry, I made a last minute change and put a logic error in imgconvert.cpp.
The check for to pdf or not to pdf was wrong.

Here is the corrected version.

Stephan



0002-imgconvert.patch
Description: Binary data


[PATCH] Re: How to setup image converters on Mac?

2017-09-24 Thread Stephan Witt
Am 21.09.2017 um 15:08 schrieb Stephan Witt :
> 
> Am 21.09.2017 um 14:54 schrieb Enrico Forestieri :
>> 
>> On Thu, Sep 21, 2017 at 11:43:29AM +0200, Stephan Witt wrote:
>>> 
>>> My question (again): how can I circumvent this and configure „my“ converter
>>> so it’s used to convert the SVG to PNG and run pdflatex with the PNG instead
>>> of the PDF (which would be rasterized anyway, when ImageMagick is used for
>>> SVG to PDF conversion).
>> 
>> Maybe you can use again Qt to convert the SVG to a rasterized PDF.
>> See the attached example. Note that this is not actually limited
>> to SVG but is able to convert to PDF any format natively understood
>> by Qt (even if the original vector format is lost).
> 
> Thank you. That’s not the solution I’d expected. But of course I’ll try that.
> I’d combine your code snippets into a single converter utility if it works.
> 
> I’ll keep you up-to-date. :)

This is the solution I’d like to propose. It’s not tested on Linux and Windows.

The idea is to add imgconvert as fallback-converter for SVG to PDF and PNG to 
PDF.
At the moment it uses the Qt library routines for image processing. I’ll plan
to investigate how to integrate libcairo for real vector graphics conversion.

I’d like to hear your comments.

Stephan



0001-imgconvert.patch
Description: Binary data


Re: How to setup image converters on Mac?

2017-09-22 Thread Guenter Milde
On 2017-09-21, Stephan Witt wrote:
> Am 21.09.2017 um 09:50 schrieb Jürgen Spitzmüller :
>> 2017-09-20 22:20 GMT+02:00 Stephan Witt :

...
> ... the mentioned fallback means LyX is able to show the document with
> SVG on screen using internal Qt when converters are missing and using
> the first detected converter otherwise. The hope is that the external
> converter does a better job than Qt.

> Without any converter you are unable to preview the document in PDF and
> print it.

You can still print via HTML (of course the quality may be a problem).

Under Linux, TeXLive, previewers, and ImageMagick are expected to be
present for normal operation. They are installed by default together with
LyX but no strict requirements:

 Recommends: texlive-latex-recommended, texlive-latex-extra,
 texlive-science, texlive-generic-recommended, texlive-generic-extra,
 texlive-fonts-recommended, preview-latex-style, dvipng, imagemagick,
 psutils, ghostscript, poppler-utils, fonts-lyx, evince-gtk | pdf-viewer,
 elyxer | tex4ht | hevea | tth | latex2html

So, yes, in case requiring ImageMagick is a problem on the Mac, we need a
different fallback converter.

Günter



Re: How to setup image converters on Mac?

2017-09-22 Thread Enrico Forestieri
On Fri, Sep 22, 2017 at 11:26:47AM +0200, Enrico Forestieri wrote:
> 
> If you want to preserve the vector format, you could also try to
> statically link the following:
> https://github.com/openclipart-dev/svg2pdf

In which case, the following may also be of interest to you:
http://blog.mathieu-leplatre.info/static-build-of-cairo-and-librsvg.html

-- 
Enrico


Re: How to setup image converters on Mac?

2017-09-22 Thread Enrico Forestieri
On Thu, Sep 21, 2017 at 03:08:45PM +0200, Stephan Witt wrote:
> Am 21.09.2017 um 14:54 schrieb Enrico Forestieri :
> > On Thu, Sep 21, 2017 at 11:43:29AM +0200, Stephan Witt wrote:
> >> 
> >> My question (again): how can I circumvent this and configure „my“ converter
> >> so it’s used to convert the SVG to PNG and run pdflatex with the PNG 
> >> instead
> >> of the PDF (which would be rasterized anyway, when ImageMagick is used for
> >> SVG to PDF conversion).
> > 
> > Maybe you can use again Qt to convert the SVG to a rasterized PDF.
> > See the attached example. Note that this is not actually limited
> > to SVG but is able to convert to PDF any format natively understood
> > by Qt (even if the original vector format is lost).
> 
> Thank you. That’s not the solution I’d expected. But of course I’ll try that.
> I’d combine your code snippets into a single converter utility if it works.

If you want to preserve the vector format, you could also try to
statically link the following:
https://github.com/openclipart-dev/svg2pdf

-- 
Enrico


Re: How to setup image converters on Mac?

2017-09-21 Thread Stephan Witt
Am 21.09.2017 um 14:54 schrieb Enrico Forestieri :
> 
> On Thu, Sep 21, 2017 at 11:43:29AM +0200, Stephan Witt wrote:
>> 
>> My question (again): how can I circumvent this and configure „my“ converter
>> so it’s used to convert the SVG to PNG and run pdflatex with the PNG instead
>> of the PDF (which would be rasterized anyway, when ImageMagick is used for
>> SVG to PDF conversion).
> 
> Maybe you can use again Qt to convert the SVG to a rasterized PDF.
> See the attached example. Note that this is not actually limited
> to SVG but is able to convert to PDF any format natively understood
> by Qt (even if the original vector format is lost).

Thank you. That’s not the solution I’d expected. But of course I’ll try that.
I’d combine your code snippets into a single converter utility if it works.

I’ll keep you up-to-date. :)

Stephan



Re: How to setup image converters on Mac?

2017-09-21 Thread Enrico Forestieri
On Thu, Sep 21, 2017 at 11:43:29AM +0200, Stephan Witt wrote:
> 
> My question (again): how can I circumvent this and configure „my“ converter
> so it’s used to convert the SVG to PNG and run pdflatex with the PNG instead
> of the PDF (which would be rasterized anyway, when ImageMagick is used for
> SVG to PDF conversion).

Maybe you can use again Qt to convert the SVG to a rasterized PDF.
See the attached example. Note that this is not actually limited
to SVG but is able to convert to PDF any format natively understood
by Qt (even if the original vector format is lost).

-- 
Enrico
/*
set cflags=`env PKG_CONFIG_PATH=/usr/local/qt5/lib/pkgconfig pkg-config 
--cflags Qt5Widgets`
set libs=`env PKG_CONFIG_PATH=/usr/local/qt5/lib/pkgconfig pkg-config --libs 
--static Qt5Widgets`
g++ -std=gnu++11 $cflags qsvg2pdf.cpp -o qsvg2pdf $libs
*/
#include 
#include 
#include 
#include 

int main(int argc, char **argv)
{
if (argc != 3) {
std::cerr << "Usage: " << argv[0]
  << " input.svgz output.pdf" << std::endl;
return 1;
}
QApplication app(argc, argv);
QPixmap pm;
if (!pm.load(QString::fromLocal8Bit(argv[1]))) {
std::cerr << "Cannot load image " << argv[1] << std::endl;
return 1;
}
QSize size = pm.size();
QPdfWriter pdfwriter(QString::fromLocal8Bit(argv[2]));
int dpi = pdfwriter.logicalDpiX();
QPageSize pagesize(size * qreal(72.0 / dpi));
QMarginsF margins(0, 0, 0, 0);
QPageLayout pagelayout(pagesize, QPageLayout::Portrait, margins);
pdfwriter.setPageLayout(pagelayout);
QPainter painter();
painter.drawPixmap(0, 0, pm);
painter.end();
return 0;
}



Re: How to setup image converters on Mac?

2017-09-21 Thread Stephan Witt
Am 21.09.2017 um 11:31 schrieb Guenter Milde :
> 
> On 2017-09-20, Scott Kostyshak wrote:
>> On Wed, Sep 20, 2017 at 10:20:04PM +0200, Stephan Witt wrote:
> 
>>> Shouldn’t the Linux packagers
>>> made aware of the dependency of LyX on Inkscape?
> 
> On Linux, we have working alternatives to Inkscape (rsvgbased).
> 
>> I don't know. Currently, the "lyx" package on Ubuntu lists "inkscape" as
>> a "suggested" package.
> 
> We should tell them to "upgrade" the dependency on an SVG->PDF converter
> from "suggested" to "recommended" (because now more LyX documents include
> SVG images).

This would be good.

>>> (Yes, I know, on Linux it would work without it by using convert. But
>>> this isn’t good - an error should be raised on Linux too. :)
> 
> Actually, it is intended that even the onboard QT converter is used as
> fallback (see Jürgens post). Maybe we need to fix this (with Mac only?) and
> possibly we can add a warning (no error) in case an SVG is converted to
> raster image.

That’s the problem I wanted to solve with my initial email: I can provide
a working self-made converter from SVG to PNG on Mac. But it doesn’t help.
LyX isn’t using it for pdflatex e.g. It uses convertDefault.py instead. And
this fails if the ImageMagick tools are missing.

My question (again): how can I circumvent this and configure „my“ converter
so it’s used to convert the SVG to PNG and run pdflatex with the PNG instead
of the PDF (which would be rasterized anyway, when ImageMagick is used for
SVG to PDF conversion).

Stephan

Re: How to setup image converters on Mac?

2017-09-21 Thread Stephan Witt
Am 21.09.2017 um 09:50 schrieb Jürgen Spitzmüller :
> 
> 2017-09-20 22:20 GMT+02:00 Stephan Witt :
> > The current situation is not worse than 2.2.x, right? In other words,
> > there is no regression with regards to 2.2.x, but an argument could be
> > made that there is a regression (from the user perspective) with respect
> > to before we changed to SVG files. Did I get that correct?
> 
> Yes, the problem is present since the change from PNG icons to SVG icons.
> 
> Sorry if that has already been mentioned, but just to exclude this: the 
> info-inset problem is not related to the following?
> 
> http://www.lyx.org/trac/ticket/9778
> http://www.lyx.org/trac/changeset/6bd5263405/lyxgit
> 
> Because according to the comment in the commit, LyX should fall back to Qt's 
> (inferior) SVG ramework if no SVG to PNG converter is available.

Yes, this is somehow related. But the mentioned fallback means LyX is able to 
show the document with SVG on screen using internal Qt when converters are 
missing and using the first detected converter otherwise. The hope is that the 
external converter does a better job than Qt.

Without any converter you are unable to preview the document in PDF and print 
it.

Stephan

Re: How to setup image converters on Mac?

2017-09-21 Thread Guenter Milde
On 2017-09-20, Scott Kostyshak wrote:
> On Wed, Sep 20, 2017 at 10:20:04PM +0200, Stephan Witt wrote:

>> Shouldn’t the Linux packagers
>> made aware of the dependency of LyX on Inkscape?

On Linux, we have working alternatives to Inkscape (rsvgbased).

> I don't know. Currently, the "lyx" package on Ubuntu lists "inkscape" as
> a "suggested" package.

We should tell them to "upgrade" the dependency on an SVG->PDF converter
from "suggested" to "recommended" (because now more LyX documents include
SVG images).

>> (Yes, I know, on Linux it would work without it by using convert. But
>> this isn’t good - an error should be raised on Linux too. :)

Actually, it is intended that even the onboard QT converter is used as
fallback (see Jürgens post). Maybe we need to fix this (with Mac only?) and
possibly we can add a warning (no error) in case an SVG is converted to
raster image.

Günter



Re: How to setup image converters on Mac?

2017-09-21 Thread Jürgen Spitzmüller
2017-09-20 22:20 GMT+02:00 Stephan Witt :

> > The current situation is not worse than 2.2.x, right? In other words,
> > there is no regression with regards to 2.2.x, but an argument could be
> > made that there is a regression (from the user perspective) with respect
> > to before we changed to SVG files. Did I get that correct?
>
> Yes, the problem is present since the change from PNG icons to SVG icons.
>

Sorry if that has already been mentioned, but just to exclude this: the
info-inset problem is not related to the following?

http://www.lyx.org/trac/ticket/9778
http://www.lyx.org/trac/changeset/6bd5263405/lyxgit

Because according to the comment in the commit, LyX should fall back to
Qt's (inferior) SVG ramework if no SVG to PNG converter is available.

Jürgen


Re: How to setup image converters on Mac?

2017-09-20 Thread Scott Kostyshak
On Wed, Sep 20, 2017 at 10:20:04PM +0200, Stephan Witt wrote:

> I’m in favor of a working SVG to PNG conversion for systems without a
> SVG to PDF or EPS converter.

> Ideally for inset-info only and for SVG
> graphic insets presenting an error message.

Interesting idea to consider. I wonder if this could be easy to
implement. Could we define a new format svgdoc, and a corresponding new
converter that could potentially convert to a bitmap, and have the
icon-inset convert using that format?

> But this is too complex for 2.3.0, IMO. So I’d put my patch in and
> let some nice guys change the splash files.

Sounds good.

> Shouldn’t the Linux packagers
> made aware of the dependency of LyX on Inkscape?

I don't know. Currently, the "lyx" package on Ubuntu lists "inkscape" as
a "suggested" package.

> (Yes, I know, on Linux it would work without it by using convert. But
> this isn’t good - an error should be raised on Linux too. :)

About raising an error instead of converting a vector silently to
bitmap, when I said that, it was my personal opinion. I don't have a
release-manager opinion on that. If we want to change 2.2.x behavior in
2.3.0, we should discuss this more widely. I suppose the proposal would
be to remove convert (and its new binary name) as converter of any
vector format from configure?

> > I think that after 2.3.0 is out, we should prioritize fixing the root
> > issue. It is important that users be able to compile help files
> > out-of-the-box. In some sense, this was already not the case because we
> > ask users to install certain LaTeX packages to compile the help files,
> > but additionally asking them to install a program (especially Inkscape,
> > which I imagine is heavy) does not seem like an acceptable long-run
> > solution in my opinion.
> 
> Yes, I think so too.
> 
> > By the way, the following is a useful thread:
> > 
> >  
> > https://tex.stackexchange.com/questions/2099/how-to-include-svg-diagrams-in-latex
> 
> The solutions to output SVG to printable files with LaTeX are using
> the „evil“ shell escape, BTW.

Yes there are a lot of answers but I don't see any that practically help us.

> > One of the answers
> > 
> >  https://tex.stackexchange.com/a/2150/12212
> > 
> > suggests a program called SVG Rasterizer, which apparently can convert
> > to PDF (I believe without rasterizing, as e.g. ImageMagick would) [1],
> > is open source under the Apache License [2], is under active development
> > [3], and has a detailed list of exactly which features of SVG are
> > supported [4].
> 
> I read the text you’ve referred to with [1]. Of course I don’t know more
> but if a tool can output PNG, JPEG, TIFF and PDF I’d bet the PDF is a
> container for a rastered image only.

Ah good to know then. I must have misinterpreted the text. In any case
(as mentioned below), doesn't seem worth the time to find out.

> > But I don't imagine we would want to depend on a Java app, especially
> > since Mac does not ship anymore with the JRE [5]. I was surprised to see
> > that in configure we do check for a Java interpreter (see e.g.
> > 81633176), and for certain .jar binaries (e.g. 'htmltolatex.jar'). But I
> > suppose that checking for system-installed jar files and shipping a jar
> > file are different things. Nonetheless, since I know nothing about Java,
> > I leave my above investigation on the 0.1% chance it is useful.
> 
> The additional dependency would be bad and should better be avoided.

Makes sense.

Scott


signature.asc
Description: PGP signature


Re: How to setup image converters on Mac?

2017-09-20 Thread Stephan Witt
Am 20.09.2017 um 20:22 schrieb Scott Kostyshak :
> 
> On Mon, Sep 18, 2017 at 10:21:46AM +0200, Stephan Witt wrote:
>> Am 18.09.2017 um 05:55 schrieb Scott Kostyshak :
>>> 
>>> On Sun, Sep 17, 2017 at 06:24:46PM +0200, Stephan Witt wrote:
>>> 
> Den 13. sep. 2017 03:29, skrev Scott Kostyshak:
>> It actually amazes me how few people care about including bitmaps
 
 I certainly care too.
>>> 
>>> Rereading the email I sent, it could easily be interpreted as though I
>>> was implying that you did not care. To be clear, I'm sure you do care (I
>>> actually assumed that everyone on this list would care, and I guess that
>>> is why I was so sloppy with my poor choice of words); and I appreciate
>>> your work on finding the best practical solution for LyX users, given
>>> all of the constraints. I agree that giving an error on the first
>>> impression is not cool at all.
>>> 
>>> Scott
>> 
>> Hi Scott,
>> 
>> I'm always amazed about your marvelous words. Thank you.
>> 
>> IMO, the current situation on Mac is as follows:
>> 
>> The user starting LyX for the first time gets splash.lyx presented.
>> This file, the tutorial and the user guide cannot be printed because
>> of the included SVGZ icons.
>> 
>> With the patch (I’ve posted recently) this can be solved by the
>> installation of Inkscape. Therefore an advise in splash.lyx should
>> be given.
> 
> Agreed. I would say we would then put the advice in all of the help
> files where it is necessary.
> 
>> Pavel said the installation of the ImageMagick tools would improve
>> the LyX usability significantly. This one isn’t solved yet. But I’m
>> not sure how important the presence of ImageMagick for the average
>> user is. I think that one can live without it.
>> 
>> Unfortunately I couldn’t get an usable answer how to convert included
>> SVG images via the PNG route to printable output. This is not possible
>> because of LyX calling convertDefault.py regardless of the presence
>> of the convert utility. If I include a PNG image manually converted
>> beforehand I get a printable output.
> 
> Thanks for the summary of the situation, Stephan.
> 
> The current situation is not worse than 2.2.x, right? In other words,
> there is no regression with regards to 2.2.x, but an argument could be
> made that there is a regression (from the user perspective) with respect
> to before we changed to SVG files. Did I get that correct?

Yes, the problem is present since the change from PNG icons to SVG icons.

> Assuming that there is no regression with respect to 2.2.x, I think we
> should start thinking of temporary fixes, like the one you suggest above
> of putting a note in the help files. I'm not sure that coming up with a
> better fix is worth the extra time and the risk that it will break
> something else, considering we are thinking of rc1. I have seen several
> user reports and confusion about the issue, and I would expect several
> more even with our addition of a note, but I'm leaning towards just
> accepting that for 2.3.0. What do you think?

I’m in favor of a working SVG to PNG conversion for systems without a
SVG to PDF or EPS converter. Ideally for inset-info only and for SVG
graphic insets presenting an error message.

But this is too complex for 2.3.0, IMO. So I’d put my patch in and
let some nice guys change the splash files. Shouldn’t the Linux packagers
made aware of the dependency of LyX on Inkscape?

(Yes, I know, on Linux it would work without it by using convert. But
this isn’t good - an error should be raised on Linux too. :)

> I think that after 2.3.0 is out, we should prioritize fixing the root
> issue. It is important that users be able to compile help files
> out-of-the-box. In some sense, this was already not the case because we
> ask users to install certain LaTeX packages to compile the help files,
> but additionally asking them to install a program (especially Inkscape,
> which I imagine is heavy) does not seem like an acceptable long-run
> solution in my opinion.

Yes, I think so too.

> By the way, the following is a useful thread:
> 
>  
> https://tex.stackexchange.com/questions/2099/how-to-include-svg-diagrams-in-latex

The solutions to output SVG to printable files with LaTeX are using
the „evil“ shell escape, BTW.

> One of the answers
> 
>  https://tex.stackexchange.com/a/2150/12212
> 
> suggests a program called SVG Rasterizer, which apparently can convert
> to PDF (I believe without rasterizing, as e.g. ImageMagick would) [1],
> is open source under the Apache License [2], is under active development
> [3], and has a detailed list of exactly which features of SVG are
> supported [4].

I read the text you’ve referred to with [1]. Of course I don’t know more
but if a tool can output PNG, JPEG, TIFF and PDF I’d bet the PDF is a
container for a rastered image only.

> But I don't imagine we would want to depend on a Java app, especially
> since Mac does not ship anymore with the JRE [5]. I was 

Re: How to setup image converters on Mac?

2017-09-20 Thread Scott Kostyshak
On Mon, Sep 18, 2017 at 10:21:46AM +0200, Stephan Witt wrote:
> Am 18.09.2017 um 05:55 schrieb Scott Kostyshak :
> > 
> > On Sun, Sep 17, 2017 at 06:24:46PM +0200, Stephan Witt wrote:
> > 
> >>> Den 13. sep. 2017 03:29, skrev Scott Kostyshak:
>  It actually amazes me how few people care about including bitmaps
> >> 
> >> I certainly care too.
> > 
> > Rereading the email I sent, it could easily be interpreted as though I
> > was implying that you did not care. To be clear, I'm sure you do care (I
> > actually assumed that everyone on this list would care, and I guess that
> > is why I was so sloppy with my poor choice of words); and I appreciate
> > your work on finding the best practical solution for LyX users, given
> > all of the constraints. I agree that giving an error on the first
> > impression is not cool at all.
> > 
> > Scott
> 
> Hi Scott,
> 
> I'm always amazed about your marvelous words. Thank you.
> 
> IMO, the current situation on Mac is as follows:
> 
> The user starting LyX for the first time gets splash.lyx presented.
> This file, the tutorial and the user guide cannot be printed because
> of the included SVGZ icons.
> 
> With the patch (I’ve posted recently) this can be solved by the
> installation of Inkscape. Therefore an advise in splash.lyx should
> be given.

Agreed. I would say we would then put the advice in all of the help
files where it is necessary.

> Pavel said the installation of the ImageMagick tools would improve
> the LyX usability significantly. This one isn’t solved yet. But I’m
> not sure how important the presence of ImageMagick for the average
> user is. I think that one can live without it.
> 
> Unfortunately I couldn’t get an usable answer how to convert included
> SVG images via the PNG route to printable output. This is not possible
> because of LyX calling convertDefault.py regardless of the presence
> of the convert utility. If I include a PNG image manually converted
> beforehand I get a printable output.

Thanks for the summary of the situation, Stephan.

The current situation is not worse than 2.2.x, right? In other words,
there is no regression with regards to 2.2.x, but an argument could be
made that there is a regression (from the user perspective) with respect
to before we changed to SVG files. Did I get that correct?

Assuming that there is no regression with respect to 2.2.x, I think we
should start thinking of temporary fixes, like the one you suggest above
of putting a note in the help files. I'm not sure that coming up with a
better fix is worth the extra time and the risk that it will break
something else, considering we are thinking of rc1. I have seen several
user reports and confusion about the issue, and I would expect several
more even with our addition of a note, but I'm leaning towards just
accepting that for 2.3.0. What do you think?

I think that after 2.3.0 is out, we should prioritize fixing the root
issue. It is important that users be able to compile help files
out-of-the-box. In some sense, this was already not the case because we
ask users to install certain LaTeX packages to compile the help files,
but additionally asking them to install a program (especially Inkscape,
which I imagine is heavy) does not seem like an acceptable long-run
solution in my opinion.

By the way, the following is a useful thread:

  
https://tex.stackexchange.com/questions/2099/how-to-include-svg-diagrams-in-latex

One of the answers

  https://tex.stackexchange.com/a/2150/12212

suggests a program called SVG Rasterizer, which apparently can convert
to PDF (I believe without rasterizing, as e.g. ImageMagick would) [1],
is open source under the Apache License [2], is under active development
[3], and has a detailed list of exactly which features of SVG are
supported [4].

But I don't imagine we would want to depend on a Java app, especially
since Mac does not ship anymore with the JRE [5]. I was surprised to see
that in configure we do check for a Java interpreter (see e.g.
81633176), and for certain .jar binaries (e.g. 'htmltolatex.jar'). But I
suppose that checking for system-installed jar files and shipping a jar
file are different things. Nonetheless, since I know nothing about Java,
I leave my above investigation on the 0.1% chance it is useful.

I would appreciate other opinions on what to do, both short-run (2.3.0)
and long-run.

Scott


[1]
From what I understand by the text "despite its name" in the following
link, it implies that the conversion would be a vector conversion, i.e.,
that the resulting PDF would not be rasterized, as e.g. converting with
ImageMagick.
https://xmlgraphics.apache.org/batik/tools/rasterizer.html

[2]
https://xmlgraphics.apache.org/batik/license.html

[3]
http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/

[4]
https://xmlgraphics.apache.org/batik/status.html

[5]
https://apple.stackexchange.com/questions/102466/does-java-come-pre-installed-on-mac-os-x-10-7-10-8-and-beyond


signature.asc

Re: How to setup image converters on Mac?

2017-09-18 Thread Stephan Witt
Am 18.09.2017 um 05:55 schrieb Scott Kostyshak :
> 
> On Sun, Sep 17, 2017 at 06:24:46PM +0200, Stephan Witt wrote:
> 
>>> Den 13. sep. 2017 03:29, skrev Scott Kostyshak:
 It actually amazes me how few people care about including bitmaps
>> 
>> I certainly care too.
> 
> Rereading the email I sent, it could easily be interpreted as though I
> was implying that you did not care. To be clear, I'm sure you do care (I
> actually assumed that everyone on this list would care, and I guess that
> is why I was so sloppy with my poor choice of words); and I appreciate
> your work on finding the best practical solution for LyX users, given
> all of the constraints. I agree that giving an error on the first
> impression is not cool at all.
> 
> Scott

Hi Scott,

I'm always amazed about your marvelous words. Thank you.

IMO, the current situation on Mac is as follows:

The user starting LyX for the first time gets splash.lyx presented.
This file, the tutorial and the user guide cannot be printed because
of the included SVGZ icons.

With the patch (I’ve posted recently) this can be solved by the
installation of Inkscape. Therefore an advise in splash.lyx should
be given.

Pavel said the installation of the ImageMagick tools would improve
the LyX usability significantly. This one isn’t solved yet. But I’m
not sure how important the presence of ImageMagick for the average
user is. I think that one can live without it.

Unfortunately I couldn’t get an usable answer how to convert included
SVG images via the PNG route to printable output. This is not possible
because of LyX calling convertDefault.py regardless of the presence
of the convert utility. If I include a PNG image manually converted
beforehand I get a printable output.

Stephan

Re: How to setup image converters on Mac?

2017-09-18 Thread Stephan Witt
Am 18.09.2017 um 08:36 schrieb Jürgen Spitzmüller :
> 
> Am Sonntag, den 17.09.2017, 22:51 +0200 schrieb Stephan Witt:
>> I’ve just learned that the converter calls for on-screen display in
>> build_script in GraphicsConverter.cpp and for export to pdf seem to
>> have different interpretation of $$i ???
>> 
>> SVG to PNG works with $$i resp. $$o and not with $$b$$i resp. $$b$$o
>> SVG to PDF works with $$b$$i resp. $$b$$o and not with $$i resp. $$o
> 
> I figure you mean $$p, not $$b?
> 
> There is a difference between 
> 
> $$p The path to the input file
> 
> $$r The path to the original input file (this is different from $$p
> when a chain of converters is called)
> 
> Maybe you need $$r$$i and $$r$$o here, in both cases?
> 
> Jürgen

A little bit to late :) I missed your answer while composing my mail.

Yes, I meant $$p - I don’t know why I’ve used $$b.

Now I’ve tried $$r for SVG to PNG but it didn’t work too.

The problem is that $$i for GraphicsConverter.cpp is the full path name
of the input file already - you cannot prepend the path again…

Stephan

Re: How to setup image converters on Mac?

2017-09-18 Thread Stephan Witt
Am 17.09.2017 um 22:51 schrieb Stephan Witt :
> 
> Am 17.09.2017 um 21:07 schrieb Stephan Witt :
>> 
>> Am 17.09.2017 um 19:48 schrieb Jürgen Spitzmüller :
>>> 
>>> Am Sonntag, den 17.09.2017, 15:26 +0200 schrieb Stephan Witt:
 Because of the change directory coded in inkscape starter the $$i for
 the
 input file name leads to a „file not found“ error. With a change to
 inkscape —file=$$p/$$i --export-area-drawing --without-gui --export-
 pdf=$$p/$$o
>>> 
>>> Use $$p$$i rather than $$p/$$i. The (os-specific) path separator is
>>> appended to $$p
>> 
>> Thanks. That’s good to know.
> 
> Hmmm…
> 
> I’ve just learned that the converter calls for on-screen display in
> build_script in GraphicsConverter.cpp and for export to pdf seem to
> have different interpretation of $$i ???
> 
> SVG to PNG works with $$i resp. $$o and not with $$b$$i resp. $$b$$o
> SVG to PDF works with $$b$$i resp. $$b$$o and not with $$i resp. $$o
> 
> Am I right? Shouldn’t this be uniform?

Anyway.

Attached is a patch to make Inkscape on Mac as converter available.

The user has to download the inkscape installer, open it and drag the
Inkscape icon from the right to the left. (See attached screen-shot)

I can see two problems with my patch:

1. The inkscape availability detection
(First hunk in lib/configure.py patch)

I couldn’t get it work without the inkscape-binary hack.
I’d like to hear if something better is possible.

2. The asymmetric image path name handling for
SVG to PNG and SVG to PDF conversion.

If this cannot be improved (perhaps backwards compatibility
reasons forbid an improvement) I’ll add a comment to
explain the pitfall I fell into too. 

Stephan



inkscape-on-mac-2.patch
Description: Binary data




Re: How to setup image converters on Mac?

2017-09-18 Thread Jürgen Spitzmüller
Am Sonntag, den 17.09.2017, 22:51 +0200 schrieb Stephan Witt:
> I’ve just learned that the converter calls for on-screen display in
> build_script in GraphicsConverter.cpp and for export to pdf seem to
> have different interpretation of $$i ???
> 
> SVG to PNG works with $$i resp. $$o and not with $$b$$i resp. $$b$$o
> SVG to PDF works with $$b$$i resp. $$b$$o and not with $$i resp. $$o

I figure you mean $$p, not $$b?

There is a difference between 

$$p The path to the input file

$$r The path to the original input file (this is different from $$p
when a chain of converters is called)

Maybe you need $$r$$i and $$r$$o here, in both cases?

Jürgen

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-17 Thread Scott Kostyshak
On Sun, Sep 17, 2017 at 06:24:46PM +0200, Stephan Witt wrote:

> > Den 13. sep. 2017 03:29, skrev Scott Kostyshak:
> >> It actually amazes me how few people care about including bitmaps
> 
> I certainly care too.

Rereading the email I sent, it could easily be interpreted as though I
was implying that you did not care. To be clear, I'm sure you do care (I
actually assumed that everyone on this list would care, and I guess that
is why I was so sloppy with my poor choice of words); and I appreciate
your work on finding the best practical solution for LyX users, given
all of the constraints. I agree that giving an error on the first
impression is not cool at all.

Scott


signature.asc
Description: PGP signature


Re: How to setup image converters on Mac?

2017-09-17 Thread Stephan Witt
Am 17.09.2017 um 21:07 schrieb Stephan Witt :
> 
> Am 17.09.2017 um 19:48 schrieb Jürgen Spitzmüller :
>> 
>> Am Sonntag, den 17.09.2017, 15:26 +0200 schrieb Stephan Witt:
>>> Because of the change directory coded in inkscape starter the $$i for
>>> the
>>> input file name leads to a „file not found“ error. With a change to
>>> inkscape —file=$$p/$$i --export-area-drawing --without-gui --export-
>>> pdf=$$p/$$o
>> 
>> Use $$p$$i rather than $$p/$$i. The (os-specific) path separator is
>> appended to $$p
> 
> Thanks. That’s good to know.

Hmmm…

I’ve just learned that the converter calls for on-screen display in
build_script in GraphicsConverter.cpp and for export to pdf seem to
have different interpretation of $$i ???

SVG to PNG works with $$i resp. $$o and not with $$b$$i resp. $$b$$o
SVG to PDF works with $$b$$i resp. $$b$$o and not with $$i resp. $$o

Am I right? Shouldn’t this be uniform?

Stephan

Re: How to setup image converters on Mac?

2017-09-17 Thread Stephan Witt
Am 17.09.2017 um 19:48 schrieb Jürgen Spitzmüller :
> 
> Am Sonntag, den 17.09.2017, 15:26 +0200 schrieb Stephan Witt:
>> Because of the change directory coded in inkscape starter the $$i for
>> the
>> input file name leads to a „file not found“ error. With a change to
>> inkscape —file=$$p/$$i --export-area-drawing --without-gui --export-
>> pdf=$$p/$$o
> 
> Use $$p$$i rather than $$p/$$i. The (os-specific) path separator is
> appended to $$p

Thanks. That’s good to know.

Stephan

Re: How to setup image converters on Mac?

2017-09-17 Thread Jürgen Spitzmüller
Am Sonntag, den 17.09.2017, 15:26 +0200 schrieb Stephan Witt:
> Because of the change directory coded in inkscape starter the $$i for
> the
> input file name leads to a „file not found“ error. With a change to
> inkscape —file=$$p/$$i --export-area-drawing --without-gui --export-
> pdf=$$p/$$o

Use $$p$$i rather than $$p/$$i. The (os-specific) path separator is
appended to $$p

Jürgen

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-17 Thread Jürgen Spitzmüller
Am Sonntag, den 17.09.2017, 19:15 +0200 schrieb Stephan Witt:
> But I need to change configure.py to call inkscape with full path
> names
> for the input image and the conversion result to get it work.
> 
> Do you think this is a problem?

No. But remember to do that also for the svg2*tex scripts that also
call inkscape internally.

Jürgen

> Stephan
> 

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-17 Thread Stephan Witt

> Am 17.09.2017 um 18:41 schrieb Jürgen Spitzmüller :
> 
> Am Sonntag, den 17.09.2017, 18:01 +0200 schrieb Stephan Witt:
>>> It does. See how we deal with inkscape on windows.
>> 
>> Yes, and I don’t like it. How do you deal with it on Linux?
> 
> Linux doesn't need the full path, unless you are using some customized
> build. But then, I would set the full path directly in the preferences,
> not in a wrapper.
> 
>> That’s premature performance tuning, IMHO. Something one
>> shouldn’t do. Perhaps it’s needed on Windows. But I’m in
>> favor of my solution.
> 
> But we do the same for our own scripts (lyx2lyx for example). It's not
> tuning, it's just setting up the external programs properly.

You said this is to avoid the overhead of calling a shell script.

>>> Rather than that, shouldn't we call inkscape itself with full path
>>> from
>>> the working directory (or temp directory)?
>> 
>> No. We have no control here.
>> 
>> The inkscape binary isn’t really relocatable. So, the workaround
>> these
>> guys implemented 
> 
> Who are "these guys“?

The inkscape packagers for Mac OS.

>> is to change the current directory before running
>> the real binary. Therefore the path name of our input file cannot be
>> relative to the current working directory of the caller. It has to be
>> a full path or it won’t work. Call it a bug or not - we cannot fix
>> it. 
> 
> I fear you lost me here.

Yes, I fear it too.

You’re talking about the path to the inkscape binary.
I’m talking about the path to the image we want to convert.

LyX calls the image converter from the temporary directory.
The first step (not needed IMO - if we’re talking about performance)
is to copy the image from my home directory to the temporary
directory. The next step is to call the inkscape start script
with --file=$$i - $$i is the file name without path. This work
only with programs not changing the current directory at program
start. Normal programs don’t do that. inkscape on Mac has to
change to the root of the application bundle because the build
path names for configuration files etc. are relative (to the
application bundle). Therefore the inkscape binary cannot find our
SVG image sitting in the temporary directory. 

> Than means that you should do the tests you do in your wrapper in
>>> checkInkscape() in configure.py.
>> 
>> The additional tests are for people like Mike. The average user
>> puts the Inkscape bundle in /Applications. The benefit of having the
>> wrapper script inside of LyX is the unset of DISPLAY and that the
>> script is in LyX’s PATH and can easily be found.
> 
> It's hard for me to argue since I am not familiar with MacOS.

I cannot see why we should change the LyX binary (to unset the DISPLAY
environment variable) to avoid a 15 line wrapper script and be able to
call a shell script containing 173 lines of code to start the real
binary. And this would only work if the user puts the string
/Applications/Inkscape.app/Contents/Resources/bin in preferences.

I cannot see how to deal with the DISPLAY issue otherwise.

> So do as you please.

Thank you.

But I need to change configure.py to call inkscape with full path names
for the input image and the conversion result to get it work.

Do you think this is a problem?

Stephan



Re: How to setup image converters on Mac?

2017-09-17 Thread Jürgen Spitzmüller
Am Sonntag, den 17.09.2017, 18:01 +0200 schrieb Stephan Witt:
> > It does. See how we deal with inkscape on windows.
> 
> Yes, and I don’t like it. How do you deal with it on Linux?

Linux doesn't need the full path, unless you are using some customized
build. But then, I would set the full path directly in the preferences,
not in a wrapper.

> That’s premature performance tuning, IMHO. Something one
> shouldn’t do. Perhaps it’s needed on Windows. But I’m in
> favor of my solution.

But we do the same for our own scripts (lyx2lyx for example). It's not
tuning, it's just setting up the external programs properly.

> > Rather than that, shouldn't we call inkscape itself with full path
> > from
> > the working directory (or temp directory)?
> 
> No. We have no control here.
> 
> The inkscape binary isn’t really relocatable. So, the workaround
> these
> guys implemented 

Who are "these guys"?

> is to change the current directory before running
> the real binary. Therefore the path name of our input file cannot be
> relative to the current working directory of the caller. It has to be
> a full path or it won’t work. Call it a bug or not - we cannot fix
> it. 

I fear you lost me here.

> > Than means that you should do the tests you do in your wrapper in
> > checkInkscape() in configure.py.
> 
> The additional tests are for people like Mike. The average user
> puts the Inkscape bundle in /Applications. The benefit of having the
> wrapper script inside of LyX is the unset of DISPLAY and that the
> script is in LyX’s PATH and can easily be found.

It's hard for me to argue since I am not familiar with MacOS. So do as
you please.

Jürgen

> 
> Stephan

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-17 Thread Stephan Witt
Am 15.09.2017 um 15:13 schrieb Helge Hafting :
> 
> 
> 
> Den 13. sep. 2017 03:29, skrev Scott Kostyshak:
>> It actually amazes me how few people care about including bitmaps
>> graphics in their final meant-for-publication drafts. I wonder if I am
>> the only one that is annoyed when I am reading a PDF and see a bitmap
>> that should be a vector graphic.
> I certainly care. Vector graphics should stay in vector form all the way, if 
> at all possible. It is good being able to zoom 400% into some PDF detail and 
> still have smooth detail everywhere.

I certainly care too. But it’s a pity that there is no utility for SVG to PDF 
conversion on Mac for the normal user available. So the first impression this 
user gets is: LyX is a documentation tool without the ability to print the own 
documentation. Not very cool.

I’m interested in proposals to solve this issue.

Stephan

> 
> Many people seem not to care because they have no idea how these things 
> works. Gnuplot makes a nice-looking plot that they can include in their 
> article - and get a nice-looking print/pdf. They may not know what "vector 
> graphichs" is, but they want good-looking output in all cases!
> 
> I think we should strive to not downconvert into bitmaps of dubious 
> resolution. Those that understand cares. And for the rest, we want LyX to be 
> the tool that "just works" and always makes good output that stand up to 
> magnification.
> 
> Helge Hafting



Re: How to setup image converters on Mac?

2017-09-17 Thread Stephan Witt
Am 17.09.2017 um 17:44 schrieb Jürgen Spitzmüller :
> 
> Am Sonntag, den 17.09.2017, 15:26 +0200 schrieb Stephan Witt:
>> I’ve made a test. The cost for 200 calls of the pure shell script
>> /Applications/Inkscape.app/Contents/Resources/bin/inkscape 
>> is 0m52.436s real. The cost for 200 calls of the lyx-provided
>> wrapper lyx/development/MacOSX/inkscape is 0m53.534s real.
>> Approximately 2% overhead or 5 msecs per null converter call.
>> I’ve used --version as parameter for inkscape. When it comes to
>> conversion of real images this overhead doesn’t matter, IMO.
> 
> OK. This does not sound expensive, indeed.
> 
>>> In general, configure.py is our place where we set the correct
>>> pathes
>>> and calls to external programs. We should only use wrappers as a
>>> very
>>> last resort, if we really can't make configure.py to do it.
>> 
>> I think configure.py checks for the presence of the external program.
>> It doesn’t store the location of it.
> 
> It does. See how we deal with inkscape on windows.

Yes, and I don’t like it. How do you deal with it on Linux?
That’s premature performance tuning, IMHO. Something one
shouldn’t do. Perhaps it’s needed on Windows. But I’m in
favor of my solution.

>>> Am 17.09.2017 um 08:03 schrieb Jürgen Spitzmüller :
>>> 
 Can't we make it pass the full pathname rather than just the
 filename?
>>> 
>>> And that's exactly what my approach is trying to do.
>> 
>> The problem here is the first argument of SVG to PDF converter call:
>> inkscape --file=$$i --export-area-drawing --without-gui --export-
>> pdf=$$o
>> 
>> Because of the change directory coded in inkscape starter the $$i for
>> the
>> input file name leads to a „file not found“ error. With a change to
>> inkscape —file=$$p/$$i --export-area-drawing --without-gui --export-
>> pdf=$$p/$$o
>> 
>> it works. I don’t know if this has any drawback.
> 
> Rather than that, shouldn't we call inkscape itself with full path from
> the working directory (or temp directory)?

No. We have no control here.

The inkscape binary isn’t really relocatable. So, the workaround these
guys implemented is to change the current directory before running
the real binary. Therefore the path name of our input file cannot be
relative to the current working directory of the caller. It has to be
a full path or it won’t work. Call it a bug or not - we cannot fix it. 

> Than means that you should do the tests you do in your wrapper in
> checkInkscape() in configure.py.

The additional tests are for people like Mike. The average user
puts the Inkscape bundle in /Applications. The benefit of having the
wrapper script inside of LyX is the unset of DISPLAY and that the
script is in LyX’s PATH and can easily be found.

Stephan

Re: How to setup image converters on Mac?

2017-09-17 Thread Jürgen Spitzmüller
Am Sonntag, den 17.09.2017, 15:26 +0200 schrieb Stephan Witt:
> I’ve made a test. The cost for 200 calls of the pure shell script
> /Applications/Inkscape.app/Contents/Resources/bin/inkscape 
> is 0m52.436s real. The cost for 200 calls of the lyx-provided
> wrapper lyx/development/MacOSX/inkscape is 0m53.534s real.
> Approximately 2% overhead or 5 msecs per null converter call.
> I’ve used --version as parameter for inkscape. When it comes to
> conversion of real images this overhead doesn’t matter, IMO.

OK. This does not sound expensive, indeed.

> > In general, configure.py is our place where we set the correct
> > pathes
> > and calls to external programs. We should only use wrappers as a
> > very
> > last resort, if we really can't make configure.py to do it.
> 
> I think configure.py checks for the presence of the external program.
> It doesn’t store the location of it.

It does. See how we deal with inkscape on windows.

> > Am 17.09.2017 um 08:03 schrieb Jürgen Spitzmüller :
> > 
> > > Can't we make it pass the full pathname rather than just the
> > > filename?
> > 
> > And that's exactly what my approach is trying to do.
> 
> The problem here is the first argument of SVG to PDF converter call:
> inkscape --file=$$i --export-area-drawing --without-gui --export-
> pdf=$$o
> 
> Because of the change directory coded in inkscape starter the $$i for
> the
> input file name leads to a „file not found“ error. With a change to
> inkscape —file=$$p/$$i --export-area-drawing --without-gui --export-
> pdf=$$p/$$o
> 
> it works. I don’t know if this has any drawback.

Rather than that, shouldn't we call inkscape itself with full path from
the working directory (or temp directory)?

Than means that you should do the tests you do in your wrapper in
checkInkscape() in configure.py.

Jürgen

> 
> Stephan

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-17 Thread Stephan Witt
Am 17.09.2017 um 08:03 schrieb Jürgen Spitzmüller :
> 
> Am Samstag, den 16.09.2017, 20:46 +0200 schrieb Stephan Witt:
>> No, it doesn’t work. 
> 
> Why?

Because it doesn’t find the binary.

> 1) inkscape-bin is in
>> /Applications/Inkscape.app/Contents/Resources/bin
> 
> And then type does not find it, or what is the problem exactly

Yes. And it’s wrong to call the binary because it won’t work.
We have to prepare the script call and ensure the DISPLAY variable
isn’t set. Otherwise the binary tries to contact the X-Server.
It doesn’t matter if you pass —without-gui or not.
 
> 2) additional arguments have to be passed to avoid X-Server access
>> 
>> I’d like to provide the inkscape wrapper shell script.
> 
> I have already asked whether re-searching the location on every access
> isn't slowing down the execution. Are you sure this isn't the case?

I’ve made a test. The cost for 200 calls of the pure shell script
/Applications/Inkscape.app/Contents/Resources/bin/inkscape 
is 0m52.436s real. The cost for 200 calls of the lyx-provided
wrapper lyx/development/MacOSX/inkscape is 0m53.534s real.
Approximately 2% overhead or 5 msecs per null converter call.
I’ve used --version as parameter for inkscape. When it comes to
conversion of real images this overhead doesn’t matter, IMO.

> In general, configure.py is our place where we set the correct pathes
> and calls to external programs. We should only use wrappers as a very
> last resort, if we really can't make configure.py to do it.

I think configure.py checks for the presence of the external program.
It doesn’t store the location of it.


> Am 17.09.2017 um 08:03 schrieb Jürgen Spitzmüller :
> 
>> Can't we make it pass the full pathname rather than just the
>> filename?
> 
> And that's exactly what my approach is trying to do.

The problem here is the first argument of SVG to PDF converter call:
inkscape --file=$$i --export-area-drawing --without-gui --export-pdf=$$o

Because of the change directory coded in inkscape starter the $$i for the
input file name leads to a „file not found“ error. With a change to
inkscape —file=$$p/$$i --export-area-drawing --without-gui --export-pdf=$$p/$$o

it works. I don’t know if this has any drawback.

Stephan

Re: How to setup image converters on Mac?

2017-09-17 Thread Jürgen Spitzmüller
> Can't we make it pass the full pathname rather than just the
> filename?

And that's exactly what my approach is trying to do.

Jürgen

> 
> Richard
> 

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-17 Thread Jürgen Spitzmüller
Am Samstag, den 16.09.2017, 20:46 +0200 schrieb Stephan Witt:
> No, it doesn’t work. 

Why?

> 1) inkscape-bin is in
> /Applications/Inkscape.app/Contents/Resources/bin

And then type does not find it, or what is the problem exactly

> 2) additional arguments have to be passed to avoid X-Server access
> 
> I’d like to provide the inkscape wrapper shell script.

I have already asked whether re-searching the location on every access
isn't slowing down the execution. Are you sure this isn't the case?

In general, configure.py is our place where we set the correct pathes
and calls to external programs. We should only use wrappers as a very
last resort, if we really can't make configure.py to do it.

Jürgen

> 
> Stephan

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-16 Thread Richard Heck
On 09/16/2017 04:33 PM, Stephan Witt wrote:
> Am 16.09.2017 um 22:15 schrieb mn :
>> On 16.09.17 20:46, Stephan Witt wrote:
>>> Am 16.09.2017 um 11:58 schrieb Jürgen Spitzmüller :
> Then we should fix the checkInkscape() routine in configure.py.
> What do you need specifically? Full path? How is it determined on
> the Mac? Does
> "type -a -p inkscape-bin" work?
 Given the above is true, then the attached patch should work. Can you
 check that, please?

>>> No, it doesn’t work. 
>>>
>>> 1) inkscape-bin is in /Applications/Inkscape.app/Contents/Resources/bin
>>> 2) additional arguments have to be passed to avoid X-Server access
>>>
>>> I’d like to provide the inkscape wrapper shell script.
>> Currently I cannot test that script.
> It didn’t exist yet.
>
>> Does it check for different inkscape versions and paths?
>> It might also be found in other locations:
>> /sw/bin/
>> ~/Applications
>> and subfolders of /Applications?
> It tests for inkscape in /Applications and in PATH. 
> It expects an application bundle.
>
> I’ll attach a patch.
>
> Unfortunately it doesn’t work because the inkscape wrapper script
> changes the working directory and the conversion from svgz to pdf
> failes because of that.

Can't we make it pass the full pathname rather than just the filename?

Richard



Re: How to setup image converters on Mac?

2017-09-16 Thread Stephan Witt
Am 16.09.2017 um 22:15 schrieb mn :
> 
> On 16.09.17 20:46, Stephan Witt wrote:
>> Am 16.09.2017 um 11:58 schrieb Jürgen Spitzmüller :
> 
 Then we should fix the checkInkscape() routine in configure.py.
 What do you need specifically? Full path? How is it determined on
 the Mac? Does
 "type -a -p inkscape-bin" work?
>>> 
>>> Given the above is true, then the attached patch should work. Can you
>>> check that, please?
>>> 
>> 
>> No, it doesn’t work. 
>> 
>> 1) inkscape-bin is in /Applications/Inkscape.app/Contents/Resources/bin
>> 2) additional arguments have to be passed to avoid X-Server access
>> 
>> I’d like to provide the inkscape wrapper shell script.
> 
> Currently I cannot test that script.

It didn’t exist yet.

> Does it check for different inkscape versions and paths?
> It might also be found in other locations:
> /sw/bin/
> ~/Applications
> and subfolders of /Applications?

It tests for inkscape in /Applications and in PATH. 
It expects an application bundle.

I’ll attach a patch.

Unfortunately it doesn’t work because the inkscape wrapper script
changes the working directory and the conversion from svgz to pdf
failes because of that.

This is the log output:
===
insets/InsetGraphics.cpp (109): findTargetFormat: PDF mode
insets/InsetGraphics.cpp (656):  we have: from svgz to pdf6
insets/InsetGraphics.cpp (662): the orig file is: 
/Users/stephan/git/lyx-build/LyX-2.3.0dev.app/Contents/Resources/images/buffer-update.svgz
insets/InsetGraphics.cpp (711): The original file is 
/Users/stephan/git/lyx-build/LyX-2.3.0dev.app/Contents/Resources/images/buffer-update.svgz
A copy has been made and convert is to be called with:
file to convert = 
/var/folders/1x/zm63s22x7s591xrlgm4rl9v4gn/T/lyx_tmpdir.DvgBXrg51339/lyx_tmpbuf0/1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_images_buffer-update.svgz
 from svgz to pdf6

** (inkscape-bin:51889): WARNING **: Can't open file: 
1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_images_buffer-update.svgz
 (doesn't exist)

** (inkscape-bin:51889): WARNING **: Can't open file: 
1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_images_buffer-update.svgz
 (doesn't exist)

** (inkscape-bin:51889): WARNING **: Specified document 
1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_images_buffer-update.svgz
 cannot be opened (does not exist or not a valid SVG file)
support/Systemcall.cpp (294): Systemcall: 'inkscape 
--file="1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_images_buffer-update.svgz"
 --export-area-drawing --without-gui 
--export-pdf="1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_images_buffer-update.pdf"'
 finished with exit code 1
Error: Die Datei kann nicht konvertiert werden

Bei der Ausführung von
inkscape
--file="1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_imag…
ist ein Fehler aufgetreten
insets/InsetGraphics.cpp (788): InsetGraphics::latex outputting:
\includegraphics[width=1em]{1_Users_stephan_git_lyx-build_LyX-2_3_0dev_app_Contents_Resources_images_buffer-update.pdf}
=

Stephan



inkscape-on-mac.patch
Description: Binary data


Re: How to setup image converters on Mac?

2017-09-16 Thread Stephan Witt
Am 16.09.2017 um 11:58 schrieb Jürgen Spitzmüller :
> 
> Am Mittwoch, den 13.09.2017, 11:22 +0200 schrieb Jürgen Spitzmüller:
>> Am Mittwoch, den 13.09.2017, 09:59 +0200 schrieb Stephan Witt:
>>> I fear the detection of Inkscape on Mac is not correct. The python
>>> scripts assume the binary is inkscape if not on windows.
>> 
>> Then we should fix the checkInkscape() routine in configure.py. What
>> do
>> you need specifically? Full path? How is it determined on the Mac?
>> Does
>> "type -a -p inkscape-bin" work?
> 
> Given the above is true, then the attached patch should work. Can you
> check that, please?
> 

No, it doesn’t work. 

1) inkscape-bin is in /Applications/Inkscape.app/Contents/Resources/bin
2) additional arguments have to be passed to avoid X-Server access

I’d like to provide the inkscape wrapper shell script.

Stephan

Re: How to setup image converters on Mac?

2017-09-16 Thread Jürgen Spitzmüller
Am Mittwoch, den 13.09.2017, 11:22 +0200 schrieb Jürgen Spitzmüller:
> Am Mittwoch, den 13.09.2017, 09:59 +0200 schrieb Stephan Witt:
> > I fear the detection of Inkscape on Mac is not correct. The python
> > scripts assume the binary is inkscape if not on windows.
> 
> Then we should fix the checkInkscape() routine in configure.py. What
> do
> you need specifically? Full path? How is it determined on the Mac?
> Does
> "type -a -p inkscape-bin" work?

Given the above is true, then the attached patch should work. Can you
check that, please?

Jürgendiff --git a/lib/configure.py b/lib/configure.py
index ec033192bd..6a3af0cbe3 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -493,7 +493,13 @@ def checkDTLtools():
 return dtl_tools
 
 def checkInkscape():
-''' Check whether Inkscape is available and return the full path (Windows only) '''
+''' Check whether Inkscape is available and return the full path for Windows and Mac '''
+if sys.platform == "darwin":
+inkscape_loc = cmdOutput('type -p inkscape')
+if not inkscape_loc:
+inkscape_loc = cmdOutput('type -p inkscape-bin')
+if inkscape_loc:
+return inkscape_loc
 if os.name != 'nt':
 return 'inkscape'
 if sys.version_info[0] < 3:



signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-16 Thread Scott Kostyshak
On Wed, Sep 13, 2017 at 10:06:04AM +0200, Pavel Sanda wrote:

> So they might even
> see that the image in output pdf is somewhat blurry but the link between that
> and tiff format submitted is not there.

I can see that. I never know whether to give a comment explaining the
issue when I read PDF drafts that have slightly blurry bitmaps.
Sometimes I do, and other times I just get the feeling that they don't
care so I do not.

> Even if you understand the difference some mainstream journals will actually
> urge you to do vector->bitmap conversion on your own although they will accept
> eps as well.
>
> If you are stubborn you can get it through and spend several
> weeks just to get through several iterations of "fullfilling requirements",
> some reasonable (fonts across platforms do not work) and some less.
> Now, the alternative is simple bitmap conversion, which sorts it all in
> a split of second...

This is sad.

Scott


signature.asc
Description: PGP signature


Re: How to setup image converters on Mac?

2017-09-15 Thread Helge Hafting



Den 13. sep. 2017 03:29, skrev Scott Kostyshak:

It actually amazes me how few people care about including bitmaps
graphics in their final meant-for-publication drafts. I wonder if I am
the only one that is annoyed when I am reading a PDF and see a bitmap
that should be a vector graphic.
I certainly care. Vector graphics should stay in vector form all the 
way, if at all possible. It is good being able to zoom 400% into some 
PDF detail and still have smooth detail everywhere.


Many people seem not to care because they have no idea how these things 
works. Gnuplot makes a nice-looking plot that they can include in their 
article - and get a nice-looking print/pdf. They may not know what 
"vector graphichs" is, but they want good-looking output in all cases!


I think we should strive to not downconvert into bitmaps of dubious 
resolution. Those that understand cares. And for the rest, we want LyX 
to be the tool that "just works" and always makes good output that stand 
up to magnification.


Helge Hafting


Re: How to setup image converters on Mac?

2017-09-13 Thread Guenter Milde
On 2017-09-13, Pavel Sanda wrote:
> Stephan Witt wrote:

>> BTW, I didn???t say the installation of ImageMagick is useless. My
>> point is: LyX shouldn???t present error messages on preview of the
>> documentation as a PDF-document. That???s why I???m trying to
>> establish a conversion path from LyX+SVG-icons to PDF-output via PNG.
>> I don???t know how to do this. I suspect convertDefault.py should
>> simply be avoided if there is no usable ???convert??? or ???magick???
>> program is available.

> I know very little of Mac world. How harsh from us is to request users
> to install imagemagick on their own? Are there some binaries available
> or we effectively ask for compilation, which I understand is no way for
> generic user.

We should, however, ensure the detection of an installed Inkscape (at
least in to-be-expected locations). The LyX-wiki on SVG has some (old)
suggestions including a Mac-specific section (from the time LyX did not
auto-detect SVG converters).

> I tend to agree with Scott that silent lossy conversion of svg into
> bitmap does not sound as something we should do strive for and as a
> user I would be happier getting error and warning that something proper
> is missing in my installation and fix that first.

Yes. Especially as some users print the documents from the PDF "pre"-view
(I.e. my usual workflow is: edit, click the view toolbar button, proof-read,
print from the PDF viewer.)
Also, View and Export use the same framework, only the internal preview (in
the GUI) differs from that.

Günter





Re: How to setup image converters on Mac?

2017-09-13 Thread Jürgen Spitzmüller
Am Mittwoch, den 13.09.2017, 11:53 +0200 schrieb Stephan Witt:
> Am 13.09.2017 um 11:22 schrieb Jürgen Spitzmüller :
> > 
> > Am Mittwoch, den 13.09.2017, 09:59 +0200 schrieb Stephan Witt:
> > > I fear the detection of Inkscape on Mac is not correct. The
> > > python
> > > scripts assume the binary is inkscape if not on windows.
> > 
> > Then we should fix the checkInkscape() routine in configure.py.
> > What do
> > you need specifically? Full path? How is it determined on the Mac?
> > Does
> > "type -a -p inkscape-bin" work?
> 
> Alternatively I propose to provide an inkscape wrapper shell script
> like
> I did for calling maxima. See development/MacOSX/maxima in git.

Does this slow down the execution process? It strikes me a bit odd that
we look for the location each and every time, rather than store it once
and for all in the prefs.

Jürgen

> 
> Stephan

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-13 Thread Stephan Witt
Am 13.09.2017 um 11:22 schrieb Jürgen Spitzmüller :
> 
> Am Mittwoch, den 13.09.2017, 09:59 +0200 schrieb Stephan Witt:
>> I fear the detection of Inkscape on Mac is not correct. The python
>> scripts assume the binary is inkscape if not on windows.
> 
> Then we should fix the checkInkscape() routine in configure.py. What do
> you need specifically? Full path? How is it determined on the Mac? Does
> "type -a -p inkscape-bin" work?

Alternatively I propose to provide an inkscape wrapper shell script like
I did for calling maxima. See development/MacOSX/maxima in git.

Stephan

Re: How to setup image converters on Mac?

2017-09-13 Thread Jürgen Spitzmüller
Am Mittwoch, den 13.09.2017, 09:59 +0200 schrieb Stephan Witt:
> I fear the detection of Inkscape on Mac is not correct. The python
> scripts assume the binary is inkscape if not on windows.

Then we should fix the checkInkscape() routine in configure.py. What do
you need specifically? Full path? How is it determined on the Mac? Does
"type -a -p inkscape-bin" work?

Jürgen

signature.asc
Description: This is a digitally signed message part


Re: How to setup image converters on Mac?

2017-09-13 Thread Stephan Witt
Am 13.09.2017 um 03:29 schrieb Scott Kostyshak :
> 
> On Wed, Sep 13, 2017 at 01:59:55AM +0200, Stephan Witt wrote:
> 
>> That’s why I’m trying to establish a conversion path from LyX+SVG-icons to 
>> PDF-output via PNG.
> 
> If this is implemented and the .lyx files contains an included .svg as a
> graphic, then it would also be converted to a bitmap for the PDF output,
> right?

Yes, and no. It would be converted to a bitmap if there is no working
SVG-PDF converter on the system. Otherwise the fallback-converter
SVG2PNG of LyX will be used.

> Personally (meaning for my own use of LyX), I would prefer an
> error instead of my vector graphic being converted silently to a bitmap.
> But I realize (1) I'm not a typical LyX user and (2) including a .svg
> file is not as common as a .eps or .pdf file (which I understand do not
> need to be converted so are left as vectors?); and finally (3), I don't
> have a better proposal.

To document the potential improvement when installing a proper
converter for SVG to PDF is another option, IMO.

Stephan



Re: How to setup image converters on Mac?

2017-09-13 Thread Pavel Sanda
Stephan Witt wrote:
> >> BTW, I didn???t say the installation of ImageMagick is useless. My point 
> >> is: LyX shouldn???t present error messages on preview of the documentation 
> >> as a PDF-document. That???s why I???m trying to establish a conversion 
> >> path from LyX+SVG-icons to PDF-output via PNG. I don???t know how to do 
> >> this. I suspect convertDefault.py should simply be avoided if there is no 
> >> usable ???convert??? or ???magick??? program is available.
> > 
> > I know very little of Mac world. How harsh from us is to request users to 
> > install imagemagick on their own?
> > Are there some binaries available or we effectively ask for compilation, 
> > which I understand is no way for generic user.
> 
> I don???t know of a bundled ready-to-use solution for imagemagick on Mac.

Too bad. Unless you want to became maintainer of mac binaries for imagemagick, 
which I totally understand you don't want, then little cynical solution is to 
wait until someone else becomes frustrated enough and do it for us... :) 

Workaround for the svg problem is to convert everything to eps on our side. Or 
make svg conversion work which might take more energy than to bump convert 
routine of imagemagick :)
Anyway I stand by what I said, the svg trouble is to me much smaller problem 
than the fact that we can't do in many cases postcript output anymore.

Pavel


Re: How to setup image converters on Mac?

2017-09-13 Thread Pavel Sanda
Scott Kostyshak wrote:
> It actually amazes me how few people care about including bitmaps
> graphics in their final meant-for-publication drafts. I wonder if I am
> the only one that is annoyed when I am reading a PDF and see a bitmap
> that should be a vector graphic.

My experience is that academic ppl who are not into typography or computer
science do not distinguish between bitmap and vector format. So they might even
see that the image in output pdf is somewhat blurry but the link between that
and tiff format submitted is not there.

It's just too technical and I do not blame them. Most commonly used format for
vector graphic submission -- postscript -- simply doesn't work and the output
looks different across systems. Even if you are skilled with all sorts
of technical tools it's nightmare to produce anything fancy which looks
identical once you send it to publishing folks using different vector toolchain.

Even if you understand the difference some mainstream journals will actually
urge you to do vector->bitmap conversion on your own although they will accept
eps as well.  If you are stubborn you can get it through and spend several
weeks just to get through several iterations of "fullfilling requirements",
some reasonable (fonts across platforms do not work) and some less.
Now, the alternative is simple bitmap conversion, which sorts it all in
a split of second...

Pavel


Re: How to setup image converters on Mac?

2017-09-13 Thread Stephan Witt
Am 13.09.2017 um 09:13 schrieb Pavel Sanda :
> 
> Stephan Witt wrote:
>> BTW, I didn???t say the installation of ImageMagick is useless. My point is: 
>> LyX shouldn???t present error messages on preview of the documentation as a 
>> PDF-document. That???s why I???m trying to establish a conversion path from 
>> LyX+SVG-icons to PDF-output via PNG. I don???t know how to do this. I 
>> suspect convertDefault.py should simply be avoided if there is no usable 
>> ???convert??? or ???magick??? program is available.
> 
> I know very little of Mac world. How harsh from us is to request users to 
> install imagemagick on their own?
> Are there some binaries available or we effectively ask for compilation, 
> which I understand is no way for generic user.

I don’t know of a bundled ready-to-use solution for imagemagick on Mac.

> I tend to agree with Scott that silent lossy conversion of svg into bitmap 
> does not sound as something we should do strive for and as a user I would be 
> happier getting error and warning that something proper is missing in my 
> installation and fix that first.

But AFAICS the output of imagemagick is a bitmap anyway. So we should talk 
about Inkscape or rsvg-convert? 

I fear the detection of Inkscape on Mac is not correct. The python scripts 
assume the binary is inkscape if not on windows.

And rsvg-convert is problematic too (see Günters mails).

Looks like the next challenge…

Stephan

Re: How to setup image converters on Mac?

2017-09-13 Thread Pavel Sanda
Stephan Witt wrote:
> BTW, I didn???t say the installation of ImageMagick is useless. My point is: 
> LyX shouldn???t present error messages on preview of the documentation as a 
> PDF-document. That???s why I???m trying to establish a conversion path from 
> LyX+SVG-icons to PDF-output via PNG. I don???t know how to do this. I suspect 
> convertDefault.py should simply be avoided if there is no usable 
> ???convert??? or ???magick??? program is available.

I know very little of Mac world. How harsh from us is to request users to 
install imagemagick on their own?
Are there some binaries available or we effectively ask for compilation, which 
I understand is no way for generic user.

I tend to agree with Scott that silent lossy conversion of svg into bitmap does 
not sound as something we should do strive for and as a user I would be happier 
getting error and warning that something proper is missing in my installation 
and fix that first.

Pavel


Re: How to setup image converters on Mac?

2017-09-12 Thread Scott Kostyshak
On Wed, Sep 13, 2017 at 01:59:55AM +0200, Stephan Witt wrote:

> That’s why I’m trying to establish a conversion path from LyX+SVG-icons to 
> PDF-output via PNG.

If this is implemented and the .lyx files contains an included .svg as a
graphic, then it would also be converted to a bitmap for the PDF output,
right? Personally (meaning for my own use of LyX), I would prefer an
error instead of my vector graphic being converted silently to a bitmap.
But I realize (1) I'm not a typical LyX user and (2) including a .svg
file is not as common as a .eps or .pdf file (which I understand do not
need to be converted so are left as vectors?); and finally (3), I don't
have a better proposal.

It actually amazes me how few people care about including bitmaps
graphics in their final meant-for-publication drafts. I wonder if I am
the only one that is annoyed when I am reading a PDF and see a bitmap
that should be a vector graphic.

Thanks for your work on this tricky issue, Stephan.

Scott


signature.asc
Description: PGP signature


Re: How to setup image converters on Mac?

2017-09-12 Thread Stephan Witt
Am 11.09.2017 um 20:55 schrieb Pavel Sanda :
> 
> Stephan Witt wrote:
>>> If it's not easily possible we should at least make clear to newcomers that 
>>> lyx without tex & imagemagick will have lot of problems.
>> 
>> LyX without TeX is a problem. This can be solved by a newcomer by installing 
>> MacTeX. Easy.
>> LyX without ImageMagick shouldn???t be a problem for a user who is working 
>> with PNG, EPS and PDF images only, IMHO.
>> 
>> To install ImageMagick on a Mac you have to install Xcode and MacPorts (or 
>> HoweBrew) and use the terminal to get a running ImageMagick.
>> 
>> What is the fundamental problem I have without ImageMagick? What graphics 
>> capabilities of LyX do you refer to?
> 
> We use convert pretty much as default except when explicit converter is 
> defined so besides few formats and precisely selected output routes you'll 
> get in troubles.
> 
> I doubt even your PNG/EPS/PDF selection will be without problems. If I insert 
> png image and select postscript as output format will it work?
> Will html generation work? Will instant preview work? (didn't check, these 
> just randomly pop in my mind).

HTML generation works.
With LyXHTML I’m not sure - my systems tries to open it in iPhone simulator :) 
PDF with pdflatex works.
PDF with XeTeX works.
DVI doesn’t work - missing PNG to EPS converter. (Perhaps possible to solve 
with existing command line tool „sips“.)
OpenDocument (texht) works.
PDF (dvipdfm) doesn’t work (of course).
PDF (LuaTeX) works.
Postscript doesn’t work - missing PNG to EPS converter.
Instant preview works.

I think the most requested format is PDF - this works in various ways.
HTML and OpenDocument is working too.
Not bad, IMHO.

> Isn't it possible just to grab some statically linked convert and push it 
> into dmg package…?

Perhaps, I didn’t try it because I see it as a last resort. I don’t want to 
provide binaries grabbed from somewhere and I even don’t know if it works.

Even the route of providing self-made utilities isn’t attractive. We have to 
provide bug-fixes for them, IMO. This is not good.

Stephan

> Anyway my point was that current svgz info-inset problem is not likely big 
> deal or even showstopper because my guess is that bunch of other lyx 
> documents we distribute won't compile for various output formats without 
> convert.

Yes, that’s the problem exactly.

BTW, I didn’t say the installation of ImageMagick is useless. My point is: LyX 
shouldn’t present error messages on preview of the documentation as a 
PDF-document. That’s why I’m trying to establish a conversion path from 
LyX+SVG-icons to PDF-output via PNG. I don’t know how to do this. I suspect 
convertDefault.py should simply be avoided if there is no usable „convert“ or 
„magick“ program is available.

Stephan

> But its guess, I did not spent time to investigate.
> 
> Pavel



Re: How to setup image converters on Mac?

2017-09-11 Thread Pavel Sanda
Stephan Witt wrote:
> > If it's not easily possible we should at least make clear to newcomers that 
> > lyx without tex & imagemagick will have lot of problems.
> 
> LyX without TeX is a problem. This can be solved by a newcomer by installing 
> MacTeX. Easy.
> LyX without ImageMagick shouldn???t be a problem for a user who is working 
> with PNG, EPS and PDF images only, IMHO.
> 
> To install ImageMagick on a Mac you have to install Xcode and MacPorts (or 
> HoweBrew) and use the terminal to get a running ImageMagick.
> 
> What is the fundamental problem I have without ImageMagick? What graphics 
> capabilities of LyX do you refer to?

We use convert pretty much as default except when explicit converter is defined 
so besides few formats and precisely selected output routes you'll get in 
troubles.

I doubt even your PNG/EPS/PDF selection will be without problems. If I insert 
png image and select postscript as output format will it work?
Will html generation work? Will instant preview work? (didn't check, these just 
randomly pop in my mind).

Isn't it possible just to grab some statically linked convert and push it into 
dmg package...?


Anyway my point was that current svgz info-inset problem is not likely big deal 
or even showstopper because my guess is that bunch of other lyx documents we 
distribute won't compile for various output formats without convert. But its 
guess, I did not spent time to investigate.

Pavel


Re: How to setup image converters on Mac?

2017-09-11 Thread Jean-Marc Lasgouttes

Le 11/09/2017 à 16:50, mn a écrit :

On 11.09.17 16:18, Stephan Witt wrote:

Am 11.09.2017 um 14:12 schrieb Pavel Sanda :


Stephan Witt wrote:

What can I do to convert the LyX documents containing inset-info
instances without ImageMagick?

ATM, LyX seems to have a hard dependency on the ImageMagick
tools. On a Mac this implies the installation of MacPorts of
HomeBrew to get it. To do so one has to install Xcode from Apple.
That???s a big hurdle and I???d like to avoid it and stick to the
available command line tools.




Some people have worked on building a static binary for the mac using brew
http://blog.schdbr.de/imagemagic-osx-static-relocatable-build/

Also, it looks like mac photoshop contains such a binary:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1=13145=893c530fff60a85dfb551155dac0bb4f=15#p139258






Just to add to the confusion there are also fink.sf.net and
pkgsrc.joyent.com/install-on-osx/ as package managers available.
(There used to be even more, but the others seem to have died out?)



The inset-info is just symptom of much bigger problem - without
ImageMagick lot of LyX capabilities with graphics is gone and we
should strive to have it installed by default with lyx. Until this
is solved, svgz in inset info is just tiny issue compared to much
bigger one...

If it's not easily possible we should at least make clear to
newcomers that lyx without tex & imagemagick will have lot of
problems.


LyX without TeX is a problem. This can be solved by a newcomer by
installing MacTeX. Easy. LyX without ImageMagick shouldn’t be a
problem for a user who is working with PNG, EPS and PDF images only,
IMHO.

To install ImageMagick on a Mac you have to install Xcode and
MacPorts (or HoweBrew) and use the terminal to get a running
ImageMagick.

What is the fundamental problem I have without ImageMagick? What
graphics capabilities of LyX do you refer to?


On 15.05.16 18:49, Uwe Stöhr wrote:


Another point: You changed the info that LyX supports every image
format. It really does! (Thanks to ImageMagick and Ghostscript.)



I disagreed back then about advertising "all"; but without ImageMagick
the number of supported image formats really boils down.


greetings
Mike





Re: How to setup image converters on Mac?

2017-09-11 Thread mn
On 11.09.17 16:18, Stephan Witt wrote:
> Am 11.09.2017 um 14:12 schrieb Pavel Sanda :
>> 
>> Stephan Witt wrote:
>>> What can I do to convert the LyX documents containing inset-info
>>> instances without ImageMagick?
>>> 
>>> ATM, LyX seems to have a hard dependency on the ImageMagick
>>> tools. On a Mac this implies the installation of MacPorts of
>>> HomeBrew to get it. To do so one has to install Xcode from Apple.
>>> That???s a big hurdle and I???d like to avoid it and stick to the
>>> available command line tools.
>> 


Just to add to the confusion there are also fink.sf.net and
pkgsrc.joyent.com/install-on-osx/ as package managers available.
(There used to be even more, but the others seem to have died out?)


>> The inset-info is just symptom of much bigger problem - without
>> ImageMagick lot of LyX capabilities with graphics is gone and we
>> should strive to have it installed by default with lyx. Until this
>> is solved, svgz in inset info is just tiny issue compared to much
>> bigger one...
>> 
>> If it's not easily possible we should at least make clear to
>> newcomers that lyx without tex & imagemagick will have lot of
>> problems.
> 
> LyX without TeX is a problem. This can be solved by a newcomer by
> installing MacTeX. Easy. LyX without ImageMagick shouldn’t be a
> problem for a user who is working with PNG, EPS and PDF images only,
> IMHO.
> 
> To install ImageMagick on a Mac you have to install Xcode and
> MacPorts (or HoweBrew) and use the terminal to get a running
> ImageMagick.
> 
> What is the fundamental problem I have without ImageMagick? What
> graphics capabilities of LyX do you refer to?

On 15.05.16 18:49, Uwe Stöhr wrote:

> Another point: You changed the info that LyX supports every image
> format. It really does! (Thanks to ImageMagick and Ghostscript.)
>

I disagreed back then about advertising "all"; but without ImageMagick
the number of supported image formats really boils down.


greetings
Mike


Re: How to setup image converters on Mac?

2017-09-11 Thread Stephan Witt
Am 11.09.2017 um 14:12 schrieb Pavel Sanda :
> 
> Stephan Witt wrote:
>> What can I do to convert the LyX documents containing inset-info instances 
>> without ImageMagick?
>> 
>> ATM, LyX seems to have a hard dependency on the ImageMagick tools. On a Mac 
>> this implies the installation of MacPorts of HomeBrew to get it. To do so 
>> one has to install Xcode from Apple. That???s a big hurdle and I???d like to 
>> avoid it and stick to the available command line tools.
> 
> The inset-info is just symptom of much bigger problem - without ImageMagick 
> lot of LyX capabilities with graphics is gone and we should strive to have it 
> installed by default with lyx. Until this is solved, svgz in inset info is 
> just tiny issue compared to much bigger one...
> 
> If it's not easily possible we should at least make clear to newcomers that 
> lyx without tex & imagemagick will have lot of problems.

LyX without TeX is a problem. This can be solved by a newcomer by installing 
MacTeX. Easy.
LyX without ImageMagick shouldn’t be a problem for a user who is working with 
PNG, EPS and PDF images only, IMHO.

To install ImageMagick on a Mac you have to install Xcode and MacPorts (or 
HoweBrew) and use the terminal to get a running ImageMagick.

What is the fundamental problem I have without ImageMagick? What graphics 
capabilities of LyX do you refer to?

Stephan

Re: How to setup image converters on Mac?

2017-09-11 Thread Pavel Sanda
Stephan Witt wrote:
> What can I do to convert the LyX documents containing inset-info instances 
> without ImageMagick?
>
> ATM, LyX seems to have a hard dependency on the ImageMagick tools. On a Mac 
> this implies the installation of MacPorts of HomeBrew to get it. To do so one 
> has to install Xcode from Apple. That???s a big hurdle and I???d like to 
> avoid it and stick to the available command line tools.

The inset-info is just symptom of much bigger problem - without ImageMagick lot 
of LyX capabilities with graphics is gone and we should strive to have it 
installed by default with lyx. Until this is solved, svgz in inset info is just 
tiny issue compared to much bigger one...

If it's not easily possible we should at least make clear to newcomers that lyx 
without tex & imagemagick will have lot of problems.

Pavel


Re: How to setup image converters on Mac?

2017-09-10 Thread Stephan Witt

> Am 10.09.2017 um 20:53 schrieb Scott Kostyshak :
> 
> On Sun, Sep 10, 2017 at 11:05:42AM +0200, Stephan Witt wrote:
>> Dear all,
>> 
>> I tried to solve the issue with SVG conversion on Mac and now I’m a little 
>> bit lost.
>> 
>> The facts first:
>> 
>> Until MacTeX 2014 there was ImageMagick included in the TeX distribution for 
>> Mac. Later releases don’t have it anymore.
> 
> Do you happen to know why? (don't search if you don't, I'm just
> curious).

It’s explained here:

https://www.tug.org/mactex/TeXLive2017+Changes.pdf

"… because tex4ht, the only program supplied by TEX live that used convert, no 
longer requires that program.“

Stephan

Re: How to setup image converters on Mac?

2017-09-10 Thread Scott Kostyshak
On Sun, Sep 10, 2017 at 11:05:42AM +0200, Stephan Witt wrote:
> Dear all,
> 
> I tried to solve the issue with SVG conversion on Mac and now I’m a little 
> bit lost.
> 
> The facts first:
> 
> Until MacTeX 2014 there was ImageMagick included in the TeX distribution for 
> Mac. Later releases don’t have it anymore.

Do you happen to know why? (don't search if you don't, I'm just
curious).

Scott


signature.asc
Description: PGP signature