How to set grid ISPE to 512x512 in a HEIF image using MP4box?

Is there any way to edit a HEIF image using MP4box, specifically to manipulate the spatial extent (ispe) of the grid within the image. The current file I’m working with doesn’t have an ispe set for the grid, only for the image itself. I need to set the ispe of the grid to 512x512.

From what I understand about MP4box, it can be used for editing and packaging HEIF images. I came across a command that might be relevant for setting the grid size:

-add-derived-image (string)

This command appears to allow the creation of an image grid, overlay, or identity item. Its parameters include:

type=(grid|iovl|iden)[:opt1:optN], where you can specify the type as a grid.

image-grid-size=rxc, which sets the number of rows and columns of the grid.

image-overlay-offsets=h,v[,h,v]*, for setting the horizontal and vertical offsets in an overlay.

image-overlay-color=r,g,b,a, to set the canvas color of the overlay, with values ranging from 0 to 65535.

There are other options from .I add-image that can also be used. However, I’m not very proficient with MP4box and haven’t found examples of how to use this particular command correctly. Can anyone assist in writing the appropriate command for editing a HEIF file in this manner?

1 Like

MP4box is a suitable tool for editing HEIF images, including altering the ispe of a grid. The -add-derived-image command you mentioned is the right choice for setting the grid size. To adjust the grid to 512x512, you should use the image-grid-size parameter. Your command would look something like this:

MP4Box -add-derived-image type=grid:image-grid-size=512x512 your_input.heic -out your_output.heic

Replace your_input.heic with the name of your original HEIF file and your_output.heic with your desired output file name.

Thanks for that. What if I also want to apply additional attributes like overlay offsets or change the canvas color?

You can add more attributes in the same command. To include overlay offsets and canvas color, just append the image-overlay-offsets and image-overlay-color options. For instance:

MP4Box -add-derived-image type=grid:image-grid-size=512x512:image-overlay-offsets=100,100:image-overlay-color=255,0,0,65535 your_input.heic -out your_output.heic

This adjusts the grid size and adds an overlay with 100 horizontal and 100 vertical offsets, plus sets the canvas color to red with maximum opacity, as it uses RGBA format where values range from 0 to 65535.

Is it possible to edit multiple images or various properties in different images simultaneously with this command?

MP4Box is quite versatile, but handling multiple images or different properties across various images at once can be tricky. Typically, you’d need to execute individual commands for each image or specific property changes. However, to streamline the process for numerous images, you could write a script that automates running MP4Box with varying parameters for each image or group of changes. This method is efficient for processing a large batch of images.

Is there any workaround to create SVS files from other formats in any of these languages?