1

I have a question about image resolution, as it's not an area with which I'm particularly familiar.

I'm saving a black and white (actually, grayscale) plot I created with ggplot() (ggplot2 package) in R using ggsave(). According to a journal's specifications, "Line art (black and white) should be scanned at 1200 dpi at 1 bit." I've specified DPI in the past, but I don't understand the "1 bit" portion (contrast this with their request for color images to be "300 dpi at 8 bit", e.g.).

What option do I use in ggsave() to ensure 1 bit (or 8 bit, e.g.)? Also, a brief explanation of a "bit" in this context (at a novice level) would be appreciated.

Currently, my code reads:

ggsave("Fig01.tiff", device="tiff", width=5, dpi=1200)

I can provide a minimal working example leading up to the above ggsave() command if needed, but I don't believe it's necessary to answer the question.

Meg
  • 696
  • 1
  • 7
  • 20
  • 1
    One bit means just two colours: pure black or pure white, no grays. The R devices don't support this specifically, though `antialias="none"` with just `"black"` as a colour on a white background should allow conversion to it. – user2554330 Feb 09 '19 at 23:05
  • Hmmm...okay, so according to this journal, anything with tones of gray would be considered "colored" (and thus should be at 8 bit), not black and white, since they say "Line art (black and white)...at 1200 dpi at 1 bit", which only allows pure black and pure white? – Meg Feb 09 '19 at 23:16
  • 1
    Ah ha, just answered my own question (don't know how I missed this - I guess I've always lumped black and white and grayscale together, but obviously shouldn't!). It actually says, "Color **and grayscale** images should be scanned at 300 dpi at 8 bit." At least I learned something! Thank you! – Meg Feb 09 '19 at 23:19
  • As a follow-up, do you know how to specify 8 bit for output from `ggsave`, or is 8 bit the default for color/grayscale images? – Meg Feb 09 '19 at 23:20
  • 1
    Generally I don't think R allows you to pick bit depth. It likely uses 8 bit colour for everything. Programs like ImageMagick can convert files to specific formats. – user2554330 Feb 09 '19 at 23:46
  • Thanks for your help. I think I'll just specify 300 dpi and go with it. Thanks again! – Meg Feb 09 '19 at 23:55
  • @user2554330 If you'd like to write up a summary based on these comments as an answer, I will accept it. – Meg Feb 13 '19 at 01:45

1 Answers1

1

"One bit" means just two colours: pure black or pure white, no grays. The R devices don't support this specifically, though antialias="none" with just "black" as a colour on a white background will likely result in a just black and white pixels.

However, I don't think R allows you to pick bit depth. It likely uses 8 bit colour for everything. Programs like ImageMagick can convert files to specific formats. The magick package in R gives access to the ImageMagick functions, but I don't know what the commands would be to rewrite an image in black and white.

user2554330
  • 37,248
  • 4
  • 43
  • 90
  • Although I said this comment in the original posting, it might be helpful for people to see it here: My issue was actually in misunderstanding true black and white (ONLY black and ONLY white), as opposed to grayscale. The journal considers grayscale "colored", which requires 8 bits, not 1. This makes things much clearer! Thanks again, @user2554330! – Meg Feb 16 '19 at 22:38