Re: Graphic file formatsx

2021-12-09 Thread Neal Becker via lyx-users
I've had some issues similar to this, although none of my timings are
as long as you describe.  I often create plots with matplotlib.  I
believe that if you draw, say a scatterplot with 10^6 data points, the
resulting pdf will contain 10^6 instructions to draw points.  This may
cause slow rendering (and printing!).  The most straightforward fix I
know of is don't do that, write code to resample the results to a
smaller set.  However, that requires work on my part.

I've searched a couple of times for a software solution (say, a
backend for mpl that would automatically simplify plots), but so far I
haven't found anything.  Similarly, it would be nice to have a
solution that directly simplifies a pdf.  I don't think this is the
same thing as compressing a pdf (although I could be wrong).

On Thu, Dec 9, 2021 at 4:44 AM Dr Eberhard Lisse via lyx-users
 wrote:
>
> Steve,
>
> On the Mac I do
>
> brew install --cask pdf-squeezer
>
> works well, and so I bought the license.  Comes even with a command line
> utility so it went straight into the Makefile :-)-O
>
> I must confess, I have a 3.9 MB accounting software of which I only need
> the installation part which is 6 pages, so I use qpdf to pull out those,
> making 75K.
>
>  brew install qpdf
>
> Besides not having answered (timed) how long it takes, I would
> personally, besides looking at shrinkers, int he first instance look at
> how the sucker is generated and work on that.
>
> I save my images on R with ggplot2::ggsave and the help page shows:
>
> device  Device to use. Can either be a device function (e.g. png),
> or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg",
> "tiff", "png", "bmp", "svg" or "wmf" (windows only).
>
> I however, put the R chunks into my LyX files so that the images are
> generated on the fly (knitR).
>
> You asked in another message how many words my handbook has.  It has 25
> child documents and I don't know how to run the stats from the comand
> line, but the result has 950 pages. As I wrote elsewhere when working
> on a chapter I can compile that child document separately which takes
> 5-10 seconds and look at that before running the Makefile. Works for me.
>
> greetings, el
>
> On 08/12/2021 19:37, Steve Litt wrote:
> > Rich Shepard said on Wed, 8 Dec 2021 07:51:56 -0800 (PST)
> >
> >> On Wed, 8 Dec 2021, Dr Eberhard Lisse wrote:
> >
> >>> For my big handbook (which takes 110 seconds to compile (70 on the
> >>> M1)) I have split this into child documents which compile
> >>> individually within 10 to 15 seconds.
> >>
> >> How about loading a PDF image that's 3,704,503 bytes in size while
> >> reading your big handbook?
> >
> > OK, 3,704,503 bytes got my attention. No wonder it's slow.
> >
> > There are ways to shrink PDF size:
> >
> > Web search: linux shrink pdf size
> >
> > SteveT
> [...]
>
>
> --
> To email me replace 'nospam' with 'el'
>
> --
> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users



-- 
Those who don't understand recursion are doomed to repeat it
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-09 Thread Dr Eberhard Lisse via lyx-users

Steve,

On the Mac I do

brew install --cask pdf-squeezer

works well, and so I bought the license.  Comes even with a command line
utility so it went straight into the Makefile :-)-O

I must confess, I have a 3.9 MB accounting software of which I only need
the installation part which is 6 pages, so I use qpdf to pull out those,
making 75K.

 brew install qpdf

Besides not having answered (timed) how long it takes, I would
personally, besides looking at shrinkers, int he first instance look at
how the sucker is generated and work on that.

I save my images on R with ggplot2::ggsave and the help page shows:

device  Device to use. Can either be a device function (e.g. png),
or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg",
"tiff", "png", "bmp", "svg" or "wmf" (windows only).

I however, put the R chunks into my LyX files so that the images are
generated on the fly (knitR).

You asked in another message how many words my handbook has.  It has 25
child documents and I don't know how to run the stats from the comand
line, but the result has 950 pages. As I wrote elsewhere when working
on a chapter I can compile that child document separately which takes
5-10 seconds and look at that before running the Makefile. Works for me.

greetings, el

On 08/12/2021 19:37, Steve Litt wrote:

Rich Shepard said on Wed, 8 Dec 2021 07:51:56 -0800 (PST)


On Wed, 8 Dec 2021, Dr Eberhard Lisse wrote:



For my big handbook (which takes 110 seconds to compile (70 on the
M1)) I have split this into child documents which compile
individually within 10 to 15 seconds.


How about loading a PDF image that's 3,704,503 bytes in size while
reading your big handbook?


OK, 3,704,503 bytes got my attention. No wonder it's slow.

There are ways to shrink PDF size:

Web search: linux shrink pdf size

SteveT

[...]


--
To email me replace 'nospam' with 'el'

--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-08 Thread Murat Yildizoglu via lyx-users
This is not a problem of the text content.

 When you create a points plot in R, it puts the information about all the 
points in the exported PDF figure, even if many of them correspond to the same 
coordinates. It does not « flatten » the pdf figure. When you plot millions of 
points, that results in a lot of information and may necessitate considerable 
amount of memory from the computer for displaying on the screen or from the 
printer, to transfer on paper. 
When we export to a bitmap format like PNG, the information is « flattened » 
and all points that fall on the same pixels are coded just the value of these 
pixels. That makes the figure easier to handle. 

When you do a curve plot (like a density plot, for example) this problem does 
not exist. This is another strategy that I  use when possible: can I show the 
same informed with a curve instead of with dots? If yes, I go for it. It is 
much more parsimonious. 

Using a bitmap format with correct proportions and sufficient density, the 
first solution gives very satisfactory results even if the figures are bitmaps. 

--

Prof. Murat Yildizoglu


> Le 9 déc. 2021 à 00:37, Steve Litt  a écrit :
> 
> Rich Shepard said on Wed, 8 Dec 2021 07:51:56 -0800 (PST)
> 
>> On Wed, 8 Dec 2021, Dr Eberhard Lisse wrote:
> 
>>> For my big handbook (which takes 110 seconds to compile (70 on the
>>> M1)) I have split this into child documents which compile
>>> individually within 10 to 15 seconds.  
>> 
>> How about loading a PDF image that's 3,704,503 bytes in size while
>> reading your big handbook?
> 
> OK, 3,704,503 bytes got my attention. No wonder it's slow.
> 
> There are ways to shrink PDF size:
> 
> Web search: linux shrink pdf size
> 
> SteveT
> 
> Steve Litt 
> Spring 2021 featured book: Troubleshooting Techniques of the Successful
> Technologist http://www.troubleshooters.com/techniques
> -- 
> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-08 Thread Steve Litt
Rich Shepard said on Wed, 8 Dec 2021 07:51:56 -0800 (PST)

>On Wed, 8 Dec 2021, Dr Eberhard Lisse wrote:

>> For my big handbook (which takes 110 seconds to compile (70 on the
>> M1)) I have split this into child documents which compile
>> individually within 10 to 15 seconds.  
>
>How about loading a PDF image that's 3,704,503 bytes in size while
>reading your big handbook?

OK, 3,704,503 bytes got my attention. No wonder it's slow.

There are ways to shrink PDF size:

Web search: linux shrink pdf size

SteveT

Steve Litt 
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-08 Thread Steve Litt
Dr Eberhard Lisse said on Wed, 8 Dec 2021 17:14:33 +0200

>What does "slowly" mean?
>
>One could try the "draft" option (of graphicx) which should speed
>things up until the production runs.
>
>For my big handbook (which takes 110 seconds to compile (70 on the M1))
>I have split this into child documents which compile individually
>within 10 to 15 seconds.

That's a lot of time. How many words is this book?

SteveT

Steve Litt 
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-08 Thread Rich Shepard

On Wed, 8 Dec 2021, Dr Eberhard Lisse wrote:


What does "slowly" mean?


It means that when the compiled PDF document reaches a page with the large
data image it sits there while the image appears. I've not timed it but it's
much longer than displaying a new page with text or smaller images.


One could try the "draft" option (of graphicx) which should speed
things up until the production runs.


Regardless of a 'draft' image loading more quickly that's not what readers
use.


For my big handbook (which takes 110 seconds to compile (70 on the M1))
I have split this into child documents which compile individually
within 10 to 15 seconds.


How about loading a PDF image that's 3,704,503 bytes in size while reading
your big handbook?

Rich
--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-08 Thread Dr Eberhard Lisse

What does "slowly" mean?

One could try the "draft" option (of graphicx) which should speed
things up until the production runs.

For my big handbook (which takes 110 seconds to compile (70 on the M1))
I have split this into child documents which compile individually
within 10 to 15 seconds.

greetings, el

On 07/12/2021 19:33, Rich Shepard wrote:

Most of the graphics I import into a LyX document are PDFs.  When the
data sets are large they load slowly.

When I create a figure float I see that it's converted to a preferred
format.

Would these figures load more quickly if they were pre-converted?
What is the preferred format?

TIA,

Rich


--
To email me replace 'nospam' with 'el'

--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-07 Thread Steve Litt
Rich Shepard said on Tue, 7 Dec 2021 09:33:56 -0800 (PST)

>Most of the graphics I import into a LyX document are PDFs. When the
>data sets are large they load slowly.
>
>When I create a figure float I see that it's converted to a preferred
>format.
>
>Would these figures load more quickly if they were pre-converted? What
>is the preferred format?

As far as my diagrams created in Inkscape, I put them in the images
folder as .svg, and tell LyX to compile each to PDF. PDF completely
saves the vector information, so that you can resize without
significant jaggies.

Obviously, if the .svg is huge, the PDF will be huge, and conversion
will take a long time. As far as I know, LyX only performs the
conversion when:

1) There's no PDF, or

2) The .svg is newer than the current PDF.

So if I were in your position, I'd set LyX to SVG=>PDF, and let LyX do
its job.

Now if by "load slowly" you mean five minutes or more, there's an
alternative. You can set up a shellscript to use Inkscape or something
else to convert SVG=>PDF, and then use software to shrink the PDF. Web
search "how to shrink PDFs in Linux" for the various alternatives. The
last step for the shellscript is to place the newly converted and
processed PDF in the images directory. To do this, of course, you need
to set your LyX document to load the PDF, not the SVG.

The benefit of the shellscript is you can continue to work while the
software converts and shrinks your image.

HTH,

SteveT

Steve Litt 
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-07 Thread Rich Shepard

On Tue, 7 Dec 2021, Ricardo Berlasso wrote:


https://tex.stackexchange.com/questions/1072/which-graphics-formats-can-be-included-in-documents-processed-by-latex-or-pdflat


I infer from this page that a graphic built from a large data set will take
a longer time to load, and if it's vector graphics (which all statistical
plots are) then PDF is the proper format even though LyX says it's
translating the figure to some other format.

Rich
--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-07 Thread Rich Shepard

On Tue, 7 Dec 2021, Ricardo Berlasso wrote:


Slowly when editing the document or when compiling it? When you insert a
graphic, in the LaTeX options tab it's possible to uncheck the "show in
LyX" option, this will make everything faster (I think)


Ricardo,

When loadin in the compiled PDF.


That depends on the engine you're using: pdflatex, xelatex, lualatex, etc.
See for example here
https://tex.stackexchange.com/questions/1072/which-graphics-formats-can-be-included-in-documents-processed-by-latex-or-pdflat


pdflatex

Thanks,

Rich
--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphic file formatsx

2021-12-07 Thread Ricardo Berlasso
El mar, 7 dic 2021 a las 18:34, Rich Shepard ()
escribió:

> Most of the graphics I import into a LyX document are PDFs. When the data
> sets are large they load slowly.
>

Slowly when editing the document or when compiling it? When you insert a
graphic, in the LaTeX options tab it's possible to uncheck the "show in
LyX" option, this will make everything faster (I think)


> When I create a figure float I see that it's converted to a preferred
> format.
>
> Would these figures load more quickly if they were pre-converted? What is
> the preferred format?
>

That depends on the engine you're using: pdflatex, xelatex, lualatex, etc.
See for example here

https://tex.stackexchange.com/questions/1072/which-graphics-formats-can-be-included-in-documents-processed-by-latex-or-pdflat

Regards,
Ricardo



>
> TIA,
>
> Rich
> --
> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users
>
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Graphic file formatsx

2021-12-07 Thread Rich Shepard

Most of the graphics I import into a LyX document are PDFs. When the data
sets are large they load slowly.

When I create a figure float I see that it's converted to a preferred
format.

Would these figures load more quickly if they were pre-converted? What is
the preferred format?

TIA,

Rich
--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users