Twinside / Juicy.Pixels

Haskell library to load & save pictures
BSD 3-Clause "New" or "Revised" License
237 stars 57 forks source link

`readMetadata`, without decoding image #193

Open justinlovinger opened 4 years ago

justinlovinger commented 4 years ago

I currently have an application where I am processing images with HIP. HIP has it's own function to read images, but it doesn't come with metadata. Juicy.Pixels can read metadata, but it can't read metadata without decoding the image. I have to either decode all images twice, just to get metadata, or re-create portions of HIP to convert a Juicy.Pixels image into a HIP image.

I would be nice if Juicy.Pixels could read metadata without also decoding an image.

Twinside commented 4 years ago

I think you can load your image with JuicyPixels and then pass it to HIP with some hoops, it sure has been done before as HIP load some images through JuicyPixels

lehins commented 4 years ago

@Twinside is right, it is possible to use JuicyPixels reading facilities directly and then use an explicit cast to HIP Image fromat with helper functions from the conversion section. FYI there is a newer package called massiv-io that allows to read an image together with the Metadata and it will be available with HIP in hopefully not so distant future.

That being said, it could be useful to extract decoding of Metadata into standalone functions in JuicyPixels. I am sure there are use cases when only the image data itself is not needed and considering that JuicyPixels already has implementation for getting the Metadata it makes sense that it could be made available to users on its own.