0

I found a bmp image file online, right clicked on it, saved it as bmp format in a local directory. Using MS Paint, I could open and view the file. Paint says the picture-file is 42.2K bytes, 240 dpi, height 0.5in, and width 0.5in. But when I tried to insert the image into a plain TeX-coded document using XeTeXpicture, there was just a blank space where the picture should be. I bracketed the bmp image with letters a and b just to set the context. From an earlier question which was answered by Akira Kakuto, see Using Xetex to Include bmp file into document using Plain TeX I was already given a sample bmp file that worked. So it must be something about how I am saving the bmp image from the internet.

4
  • 1
    If it works with one bmp but not with another it is quite probably that something is wrong with the one bmp. But without the actual file nobody will be able to test it. (The site you linked too in your first question didn't offer me bmp files, only gif.) Dec 6 '18 at 17:28
  • @UlrikeFischer I am using windows 10 and the edge browser. I went to that site right clicked on the smaller state seal image selected save as, and then selected file type BMP. Then I saved it. Perhaps there is a way for me to upload the file that I saved?
    – GAS4
    Dec 6 '18 at 18:02
  • 1
    if the original format is gif you can't change the type when saving. Renaming a gif to bmp to make it a bmp. Dec 6 '18 at 18:05
  • You could save the file from ms paint as a png file, then load that. Dec 6 '18 at 21:01
0

Microsoft Internet Explorer (and Edge) will allow users to chose save format for a web image. Given the choice most Windows users would prefer to save as 24 bit BMP (16 million colour) rather than 8 bit (256 colour) GIF

Actually in this example its 32 colour greyscale as BMP or 18 colour as GIF so there is a noticable difference.

Microsoft do not set a DPI recognisable by some graphics apps in either of these downloaded formats (although MSPaint will often show 96 dpi as its working default)

Thus in order to ensure TeX applications can calculate a size for subsequent placement we need to RE-save as a convenient format such as 96 dpi PNG (32 bits)

Oddly if you then resave the new PNG as 24 bit BMP it magically is redefined as a 96 dpi BMP !!

Using this example

% test.tex
% xetex test.tex
this is raw downloaded bmp = invisible
\XeTeXpicfile raw-seal_3.bmp width 6cm
\par
png visible
\XeTeXpicfile nh-seal_3.png width 6cm
modified bmp visible
\XeTeXpicfile mod-seal_3.bmp width 6cm
\bye

This is the result enter image description here

3
  • Yes I know that's 50 shades of grey but I resisted putting that in my answer
    – user170109
    Dec 7 '18 at 1:37
  • KJO. Thank you for helping. A little more help is needed please. If I am looking at this internet site, etc.usf.edu/clipart/1900/1954/nh-seal_3.htm, exactly what steps to follow to get a bmp of the smallest graphic (the first one on the page labeled 320x313) that TeX applications can use? Right click, select save as BMP, then use what application to RE-save as 96dpi PNG, then use what application to re-save the new PNG as 24 bit BMP?
    – GAS4
    Dec 7 '18 at 13:40
  • That was the sample I tested right click save as bmp open with MSpaint then SAVE AS other format PNG it will change title to ....png so SAVE AS BMP it will now be bmp with a fixed 96 dpi so that should be usable but the PNG is preferable
    – user170109
    Dec 7 '18 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.