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

Image data formats: Saving in various formats #719

Open
tischi opened this issue Sep 3, 2024 · 3 comments
Open

Image data formats: Saving in various formats #719

tischi opened this issue Sep 3, 2024 · 3 comments

Comments

@tischi
Copy link
Collaborator

tischi commented Sep 3, 2024

Hi @manerotoni, @k-dominik, @jkh1,

I am working on an image data formats course and trying to think how to best structure this vast and complex topic.

Along those lines I found that this activity, while it is somehow very important, it is also a bit problematic: https://neubias.github.io/training-resources/image_file_formats/index.html?id_activity_platform-1=imagej-gui-activity-1&id_activity_platform-0=null-activity-0#save

  1. The general instructions "change the contrast limits" and then "save as" cannot be done in python scripting.
  2. Some of the things are actually useful and relevant: sometimes saving as JPEG, GIF, or PNG may be important for web viewing and thus maybe would be need a more proper introduction.

I am thinking to change https://neubias.github.io/training-resources/image_file_formats in the following ways

  • Make this only about understanding and inspecting various image data formats (this is complex enough)
  • Have dedicated modules for writing image data
    • There will be an OME-TIFF and OME-Zarr modules where it will be taught how to create these formats
    • Maybe we could add a "web friendly image data formats" module and there teach JPEG, PNG, GIF and also how to write them? (one could also have dedicated modules for each of those formats).

In a nutshell: I feel it is OK to just have one module about inspecting and opening various image data formats, but I feel that writing image data (and all the issues of loss of data, loss of metadata, compression, which library to use, ...) is too complex and too important to be put into one module, but needs to separated into dedicated modules (e.g., OME-TIFF, OME-Zarr, Web native formats) that just teach one or few formats.

What do you think?

@jkh1
Copy link

jkh1 commented Sep 3, 2024

Having two modules sounds good. It could allow to go a bit deeper. Understanding the content of an image file and what is packed into a particular format should be prerequisite to understanding the choice of format for writing though there would be some overlap if the two modules have to be standalone. Regarding the specific points:
1- I don't see the problem with save as in python? Why can't python do save as format X?
2- Regarding web-friendly formats, I would go for PNG only because it's lossless and free from patents (PNG images can be re-used whereas JPEG images often have artefacts). I would dedicate a whole module to time series/video formats because it's another can of worms with the codec + container combinations.

@tischi
Copy link
Collaborator Author

tischi commented Sep 3, 2024

1- I don't see the problem with save as in python? Why can't python do save as format X?

The issue is the "change the contrast limits" cannot be done, which is the point here because sometimes the different display on screen is written in to the file and even sometimes changes the data and sometimes not (I can explain you in person later).

2- Regarding web-friendly formats, I would go for PNG only because it's lossless and free from patents (PNG images can be re-used whereas JPEG images often have artefacts). I would dedicate a whole module to time series/video formats because it's another can of worms with the codec + container combinations.

Yes, GIF is useful because you can have movies, but yeah, there could be other choices.

@manerotoni
Copy link
Collaborator

Hello,
yes it is better to split the module. Saving data is often quite independent of the reading.
A typical workflow is reading data, processing and saving some results table.

You want to be able to read many formats but stick for the writing to just a few.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@tischi @manerotoni @jkh1 and others