Skip to content

Commit 7a1224c

Browse files
Reducing package file size by reducing screenshot sizes (#119)
* Adding some notes on how to reduce image size for screenshots - coming from direct experience with pngquant * updating bibliography upon executing bookdown::render_book() --------- Co-authored-by: Marcel Ramos Pérez <[email protected]>
1 parent 04d4a39 commit 7a1224c

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

general-package-development.Rmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Do not use filenames that differ only in case, as not all file systems are case-
4343
### Package size {#package-size}
4444

4545
The source package resulting from running `R CMD build` should occupy less than 5 MB on disk.
46+
If your package includes (e.g. in the vignettes) some screenshots, this limit can be reached quite quickly. Their size can be reduced (often as much as 70%) in a lossy but quality-preserving manner by using tools such as [pngquant](https://pngquant.org/) (available as a command line utility and as a GUI on most systems).
4647

4748
### Check duration {#check-duration}
4849

packages.bib

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,34 @@ @Manual{R-base
33
author = {{R Core Team}},
44
organization = {R Foundation for Statistical Computing},
55
address = {Vienna, Austria},
6-
year = {2022},
6+
year = {2024},
77
url = {https://www.R-project.org/},
88
}
99

1010
@Manual{R-bookdown,
1111
title = {bookdown: Authoring Books and Technical Documents with R Markdown},
1212
author = {Yihui Xie},
13-
year = {2022},
14-
note = {https://github.com/rstudio/bookdown},
13+
year = {2024},
14+
note = {R package version 0.38,
15+
https://pkgs.rstudio.com/bookdown/},
16+
url = {https://github.com/rstudio/bookdown},
1517
}
1618

1719
@Manual{R-knitr,
1820
title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
1921
author = {Yihui Xie},
20-
year = {2022},
21-
note = {R package version 1.41},
22+
year = {2023},
23+
note = {R package version 1.45},
2224
url = {https://yihui.org/knitr/},
2325
}
2426

2527
@Manual{R-rmarkdown,
2628
title = {rmarkdown: Dynamic Documents for R},
27-
author = {JJ Allaire and Yihui Xie and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone},
28-
year = {2022},
29-
note = {https://github.com/rstudio/rmarkdown},
29+
author = {JJ Allaire and Yihui Xie and Christophe Dervieux and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone},
30+
year = {2024},
31+
note = {R package version 2.26,
32+
https://pkgs.rstudio.com/rmarkdown/},
33+
url = {https://github.com/rstudio/rmarkdown},
3034
}
3135

3236
@Book{bookdown2016,
@@ -35,7 +39,7 @@ @Book{bookdown2016
3539
publisher = {Chapman and Hall/CRC},
3640
address = {Boca Raton, Florida},
3741
year = {2016},
38-
note = {ISBN 978-1138700109},
42+
isbn = {978-1138700109},
3943
url = {https://bookdown.org/yihui/bookdown},
4044
}
4145

@@ -58,7 +62,6 @@ @InCollection{knitr2014
5862
publisher = {Chapman and Hall/CRC},
5963
year = {2014},
6064
note = {ISBN 978-1466561595},
61-
url = {http://www.crcpress.com/product/isbn/9781466561595},
6265
}
6366

6467
@Book{rmarkdown2018,
@@ -67,7 +70,7 @@ @Book{rmarkdown2018
6770
publisher = {Chapman and Hall/CRC},
6871
address = {Boca Raton, Florida},
6972
year = {2018},
70-
note = {ISBN 9781138359338},
73+
isbn = {9781138359338},
7174
url = {https://bookdown.org/yihui/rmarkdown},
7275
}
7376

@@ -77,7 +80,7 @@ @Book{rmarkdown2020
7780
publisher = {Chapman and Hall/CRC},
7881
address = {Boca Raton, Florida},
7982
year = {2020},
80-
note = {ISBN 9780367563837},
83+
isbn = {9780367563837},
8184
url = {https://bookdown.org/yihui/rmarkdown-cookbook},
8285
}
8386

shiny-apps.Rmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ To set the name of an Rd document, use the `@name` tag in the Roxygen block:
146146
}
147147
```
148148

149+
Additionally, the vignette of a shiny app package might include some screenshots, either generated manually or programmatically.
150+
If generated manually, developers can use tools such as [pngquant](https://pngquant.org/) (available as a command line utility and as a GUI on most systems) to reduce their size (about 70%) without too much loss of quality.
151+
Programmatically generated screenshots can be realized by means of the [Webshot2](https://cran.r-project.org/package=webshot2) package, using the `webshot2::appshot()` function.
152+
149153
## Review
150154

151155
When reviewing a shiny app package, the reviewer should check that the package

0 commit comments

Comments
 (0)