SATySFi icon indicating copy to clipboard operation
SATySFi copied to clipboard

Support png images

Open leque opened this issue 1 year ago • 2 comments

This PR adds PNG images support. Supported PNG formats are monochrome, grayscale, rgb, and 4/8 bit colormap (1/2 bit colormap and alpha-channel are not supported).

Supported formats are summarized as below (full lists can be built from tests/images/test.saty): image

leque avatar Jul 23 '22 10:07 leque

Thank you so much for the enhancement!

I confirmed that it indeed works as to output PDF files. A slight warning message was shown, however:

$ cd tests/images/
$ satysfi test.saty                                
(omitted)
 ---- ---- ---- ----
  evaluating texts ...
  [Warning] (satysfi-logo-cmyk.jpg) Jpeg images with CMYK color mode are not fully supported.
  Please convert the image to a jpeg image with YCbCr (RGB) color model.
  [Warning] (peppers-cmyk.jpg) Jpeg images with CMYK color mode are not fully supported.
  Please convert the image to a jpeg image with YCbCr (RGB) color model.
  evaluation done.
 ---- ---- ---- ----
  breaking contents into pages ...
  needs another trial for solving cross references...
 ---- ---- ---- ----
  evaluating texts (2nd trial) ...
  [Warning] (satysfi-logo-cmyk.jpg) Jpeg images with CMYK color mode are not fully supported.
  Please convert the image to a jpeg image with YCbCr (RGB) color model.
  [Warning] (peppers-cmyk.jpg) Jpeg images with CMYK color mode are not fully supported.
  Please convert the image to a jpeg image with YCbCr (RGB) color model.
  evaluation done.
 ---- ---- ---- ----
  breaking contents into pages ...
  all cross references were solved.
 ---- ---- ---- ----
  embedding fonts ...
libpng warning: Interlace handling should be turned on when using png_read_image
 ---- ---- ---- ----
  writing pages ...
 ---- ---- ---- ----
  output written on 'test.pdf'.

Is the occurrence of the message libpng warning: Interlace handling should be turned on when using png_read_image expected? Probably this is not harmful, according to the following discussion, for example:

  • https://stackoverflow.com/questions/12990602/libpng-warning-interlace-handling-should-be-turned-on-when-using-png-read-image

gfngfn avatar Aug 08 '22 12:08 gfngfn

Ah, I noticed this message. It is emitted only for interlaced images (in this case, basi0g01.png).

If we use only non-interlaced pngs, we do not see this message. I think this behavior is not so harmful.

leque avatar Aug 08 '22 14:08 leque

Thank you for explanation. I understand.

I will merge this PR. Again, thank you so much for the development!

gfngfn avatar Aug 13 '22 07:08 gfngfn