Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppmsave() creates unexpected output file formats #3377

Open
ewelot opened this issue Mar 10, 2023 · 0 comments
Open

ppmsave() creates unexpected output file formats #3377

ewelot opened this issue Mar 10, 2023 · 0 comments
Labels

Comments

@ewelot
Copy link

ewelot commented Mar 10, 2023

The function ppmsave() can be used together with a format option to explicitely specify the output file format. Setting this to either ppm, pgm,pbm or pnm one would expect to get an image file containing integer data but unfortunately all variants of the format option are producing PFM files if the vips image data format is float.

While the PFM file format would be useful to preserve data precision it is very uncommon (actually an extendion to the Netpbm formats) and not much supported by other tools (even GNU find does not recognize it). I believe it would be favourable to store integer image data in PPM,PGM,PBM,PNM files. The output file format should therefore be decided on the output file extension or format option (if any other extension is used) and not deduced from the vips image data format. In turn, PFM files should only be created if using the pfm extension or corresponding format option.

When implicit casting to integer formats is required one has to consider the number of bits per pixel (per band) as well. It might therefore be useful to extend the meaning of the bitdepth option and allow values 8 and 16 as well and use this for data range clipping.

Best regards,
Thomas

EDIT: Forgot to mention that I am working with libvips 8.14.1. The format option has been introduced in 8.12.

@ewelot ewelot added the bug label Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant