Image format question

A user recently asked us this question:

I tried to make sense of the images that are stored in my Bloom books folder. All the images in the books were inserted as PNG files, but I only see page 1 as png-file, the rest have been converted to jpg.

** I couldn’t think of any reason why Page 1 isn’t converted to jpeg.

I know Bloom was always warning users against jpegs, but I’m now finding out that even for books layed out for print (A5 Portrait), Bloom is converting png-files to jpeg.

** Should we only work with jpeg in Bloom, or does Bloom have some smart way of knowing which format is best in a given situation?

For line art drawings, such as those found in the Art of Reading collection, the PNG format is preferred over JPEG because it preserves the crisp edges of the drawings much better. For full-color drawings, the preference is not as great and may depend on the artist’s taste for whether JPEG is good enough.

Bloom has trouble dealing with very large image sizes: think full page (A4/Letter) at greater than 300 DPI. When these images are laid out in memory, they can take an unbelievable amount of memory, causing the program to quickly complain that it is running out of memory. For this reason, Bloom 4.9 (the current alpha-test version) has code to shrink any overly large image down to a maximum of 3500x2550 pixels, which is enough to cover either an A4 or a Letter sheet of paper at 300 DPI. This change is made either when you import a new image or when you open an existing book with pictures bigger than the limit. This change will help several people who have run into trouble adding large images.

For the current release of Bloom (4.7), and for some time before that, whenever an image is added, JPEG files always remain in JPEG format. Other file types (PNG, TIFF, BMP) are usually saved in PNG format. However, the code also checks to see what happens if the file is saved in maximum quality JPEG format. If the resulting file size is less than half the size of the PNG file for the image, then Bloom will switch over to using the JPEG format for the image. (This was motivated by problems caused by pasting JPEG images copied from LibreOffice which lost all idea of being JPEG format in the copy/paste process. Saving these images as PNG greatly increased their size.) This happens whenever a picture is added to Bloom, and only at that time.

If this automatic change to JPEG format is causing problems, the Bloom team would be open to somehow allowing users to prevent it. Bloom certainly does not have a “smart way of knowing which format is best in a given situation!” It has a dumb way of “knowing” that saving >50% of the file size is better than retaining perfect pixels.

If JPEG files preserve the artwork well enough, then they might be preferred because of the smaller file size. This affects the sizes of ePUBs, Bloom Reader books, and even PDFs for printing, which can be important. But I certainly wouldn’t advise against using PNG images if they work for your needs, and they aren’t extremely large.