How do I use heif-enc to set a HEIC conversion's grid ISPE to 512x512?

I’ve been working on converting JPG images to HEIC format, specifically focusing on setting the ISPE (Image Spatial Extent) of the grid. My current method involves using the heif-enc command on Ubuntu, as shown in the following command:

heif-enc -o output.heic input.jpg

While this command successfully converts the JPG to HEIC, I’ve encountered an issue where the metadata of the output HEIC file does not include the ISPE of the grid. It only contains the ISPE of the image itself. I know that heif-enc allows adding a thumbnail ISPE, but I haven’t found a way to set the ISPE of the grid.

I’m aiming to set the ISPE of the grid to a typical size like 512x512. I would prefer to do this using heif-enc, but I’m open to other methods or tools if necessary. Can you guide me on how to achieve this?

1 Like

Setting the ISPE of a grid to a specific size like 512x512 in a HEIC file might require more advanced tools than heif-enc, as it’s primarily designed for straightforward encoding tasks and doesn’t typically offer extensive metadata editing capabilities.

Unfortunately, heif-enc doesn’t currently provide a direct method to adjust the grid’s ISPE in HEIC files. For more detailed manipulation of HEIC metadata, including grid properties, you will likely need to explore more comprehensive tools or libraries, such as libheif.

libheif is a robust library for handling HEIC files, and it might allow you to modify the HEIC metadata, including the grid’s ISPE, though this may involve some coding. Additionally, keep an eye on tools like ImageMagick, which are continually updated and might support such features in future versions.

Where can I find examples or documentation on using libheif to set the grid’s ISPE?

For using libheif, the best resource would be its official GitHub repository or any available documentation. Given the specificity of editing grid ISPE metadata, you might need to explore the library’s advanced features and, if necessary, contribute to its development if the functionality you need isn’t already supported.