static BuildResult fromImage(Image image, Class<? extends BuildableManifestTemplate> targetFormat)
      throws IOException {
    ImageToJsonTranslator imageToJsonTranslator = new ImageToJsonTranslator(image);
    BlobDescriptor containerConfigurationBlobDescriptor =
        Digests.computeDigest(imageToJsonTranslator.getContainerConfiguration());
    BuildableManifestTemplate manifestTemplate =
        imageToJsonTranslator.getManifestTemplate(
            targetFormat, containerConfigurationBlobDescriptor);
    DescriptorDigest imageDigest = Digests.computeJsonDigest(manifestTemplate);
    DescriptorDigest imageId = containerConfigurationBlobDescriptor.getDigest();
    return new BuildResult(imageDigest, imageId, false);
  }
Gets a {@link BuildResult} from an {@link Image}.

@param image the image
@param targetFormat the target format of the image
@return a new {@link BuildResult} with the image's digest and id
@throws IOException if writing the digest or container configuration fails
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/BuildResult.java