I am new to the HDF system and the documentation is about opaque on how
to go about taking a .jpg or jpeg file and placing it into an HDF file.
Does anyone have an example (in C or C++) on this process and any
external libraries that are needed?
I am new to the HDF system and the documentation is about opaque on how to go about taking a .jpg or jpeg file and placing it into an HDF file. Does anyone have an example (in C or C++) on this process and any external libraries that are needed?
Thanks!
The HDF library provides several compression methods for HDF images, one of them being jpeg. This is meant to be used as having your image data in your C or Fortran program and save the images in the HDF file with this compression method. These are several HDF API's that do this
has documentation on how to do it (see the pdf version of the HDF4 user's guide)
Regarding having a jpeg image and importing it to the HDF file, you would have to write a program that reads the image (using the JPEG API's) and then using the above HDF API's to store them in the HDF file.
There is also a tool on the HDF distribution (jpeg2hdf) that traverses the HDF file and saves each image that has jpeg compression to an individual jpeg file. We don't currently have a tool that does the opposite (the title of the tool is a bit misleading, it does HDF to jpeg, not jpeg to HDF).
Regarding HDF5, we are developing a tool (h52jpeg) that exports HDF5 images or HDF5 datasets contained in a HDF5 file to jpeg images. We'll post in this forum more information regarding this tool.
You will need the jpeg external library to use both HDF4 and HDF5 with jpeg.
We use the one provided by the Independent JPEG Group
[]
Robert R. White
Caesar si viveret, ad remum dareris
[]
National Renewable energy Laboratory
National Center for Photovoltaics
1617 Cole Blvd. MS 3218 Golden CO. 80401
Ph. 303-384-7802
Fx. 303-384-7600
[]
--------------------------------------------------------------
Pedro Vicente (T) 217.265-0311
pvn@hdfgroup.org
The HDF Group. 1901 S. First. Champaign, IL 61820
Hi Robert,
To work with JPEG images in HDF, you’ll want to use the HDF library APIs that support JPEG compression or you can also use https://jpegcompressor.com/ for compressing images. A helpful resource is the HDF4 User’s Guide, which provides examples of handling images. For reading JPEG files, consider using the JPEG API from the Independent JPEG Group, which is commonly used alongside HDF.