facebookresearch / playtorch

PlayTorch is a framework for rapidly creating mobile AI experiences.
https://playtorch.dev/
MIT License
830 stars 101 forks source link

Introduce new imageToFile API function signature #185

Closed raedle closed 1 year ago

raedle commented 1 year ago

Summary: Introduce new media API to get save an image to a filepath.

Example with RNFS (react-native-fs) to get a valid filepath.

import { ImageUtil, media } from 'react-native-pytorch-core';
import * as RNFS from 'react-native-fs';

const image = await ImageUtil.fromURL('https://example.com/image.jpg');
const filepath = media.imageToFile(
  image,
  RNFS.DownloadDirectoryPath + '/saved_image.png',
);
image.release();

Differential Revision: D40747565

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
playtorch ✅ Ready (Inspect) Visit Preview Jan 13, 2023 at 6:00AM (UTC)
facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D40747565

facebook-github-bot commented 1 year ago

This pull request has been merged in facebookresearch/playtorch@b191b21d2b8945b344fe7bb0c4fb7ef061f4cc74.