Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

672 B
Raw Blame
import { imageDTOToImageObject } from 'features/controlLayers/store/util';
import type { ImageDTO } from 'services/api/types';

export const getCommittedTextImageDimensions = (width: number, height: number) => ({
  width: Math.max(1, Math.ceil(width)),
  height: Math.max(1, Math.ceil(height)),
});

export const buildCommittedTextImageState = (imageDTO: ImageDTO, width: number, height: number) => {
  const committedDimensions = getCommittedTextImageDimensions(width, height);
  return imageDTOToImageObject(imageDTO, {
    image: {
      image_name: imageDTO.image_name,
      width: committedDimensions.width,
      height: committedDimensions.height,
    },
  });
};